don't update if renoted by bot
This commit is contained in:
parent
a758af1513
commit
49e9fb9001
|
@ -191,7 +191,7 @@ export async function createPerson(
|
||||||
.map((tag) => normalizeForSearch(tag))
|
.map((tag) => normalizeForSearch(tag))
|
||||||
.splice(0, 32);
|
.splice(0, 32);
|
||||||
|
|
||||||
const isBot = getApType(object) === "Service";
|
const isBot = getApType(object) !== "Person";
|
||||||
|
|
||||||
const bday = person["vcard:bday"]?.match(/^\d{4}-\d{2}-\d{2}/);
|
const bday = person["vcard:bday"]?.match(/^\d{4}-\d{2}-\d{2}/);
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ export async function updatePerson(
|
||||||
emojis: emojiNames,
|
emojis: emojiNames,
|
||||||
name: truncate(person.name, nameLength),
|
name: truncate(person.name, nameLength),
|
||||||
tags,
|
tags,
|
||||||
isBot: getApType(object) === "Service",
|
isBot: getApType(object) !== "Person",
|
||||||
isCat: (person as any).isCat === true,
|
isCat: (person as any).isCat === true,
|
||||||
isLocked: !!person.manuallyApprovesFollowers,
|
isLocked: !!person.manuallyApprovesFollowers,
|
||||||
movedToUri: person.movedTo || null,
|
movedToUri: person.movedTo || null,
|
||||||
|
|
|
@ -30,7 +30,11 @@ export default class NotesChart extends Chart<typeof schema> {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async update(note: Note, isAdditional: boolean): Promise<void> {
|
public async update(
|
||||||
|
note: Note,
|
||||||
|
isAdditional: boolean,
|
||||||
|
byBot = false,
|
||||||
|
): Promise<void> {
|
||||||
const prefix = note.userHost === null ? "local" : "remote";
|
const prefix = note.userHost === null ? "local" : "remote";
|
||||||
|
|
||||||
await this.commit({
|
await this.commit({
|
||||||
|
@ -44,7 +48,7 @@ export default class NotesChart extends Chart<typeof schema> {
|
||||||
: -1
|
: -1
|
||||||
: 0,
|
: 0,
|
||||||
[`${prefix}.diffs.renote`]:
|
[`${prefix}.diffs.renote`]:
|
||||||
note.renoteId != null ? (isAdditional ? 1 : -1) : 0,
|
note.renoteId != null && !byBot ? (isAdditional ? 1 : -1) : 0,
|
||||||
[`${prefix}.diffs.reply`]:
|
[`${prefix}.diffs.reply`]:
|
||||||
note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
[`${prefix}.diffs.withFile`]:
|
[`${prefix}.diffs.withFile`]:
|
||||||
|
|
|
@ -32,6 +32,7 @@ export default class PerUserNotesChart extends Chart<typeof schema> {
|
||||||
user: { id: User["id"] },
|
user: { id: User["id"] },
|
||||||
note: Note,
|
note: Note,
|
||||||
isAdditional: boolean,
|
isAdditional: boolean,
|
||||||
|
byBot = false,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await this.commit(
|
await this.commit(
|
||||||
{
|
{
|
||||||
|
@ -44,7 +45,8 @@ export default class PerUserNotesChart extends Chart<typeof schema> {
|
||||||
? 1
|
? 1
|
||||||
: -1
|
: -1
|
||||||
: 0,
|
: 0,
|
||||||
"diffs.renote": note.renoteId != null ? (isAdditional ? 1 : -1) : 0,
|
"diffs.renote":
|
||||||
|
note.renoteId != null && !byBot ? (isAdditional ? 1 : -1) : 0,
|
||||||
"diffs.reply": note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
"diffs.reply": note.replyId != null ? (isAdditional ? 1 : -1) : 0,
|
||||||
"diffs.withFile": note.fileIds.length > 0 ? (isAdditional ? 1 : -1) : 0,
|
"diffs.withFile": note.fileIds.length > 0 ? (isAdditional ? 1 : -1) : 0,
|
||||||
},
|
},
|
||||||
|
|
|
@ -163,6 +163,7 @@ export default async (
|
||||||
host: User["host"];
|
host: User["host"];
|
||||||
isSilenced: User["isSilenced"];
|
isSilenced: User["isSilenced"];
|
||||||
createdAt: User["createdAt"];
|
createdAt: User["createdAt"];
|
||||||
|
isBot: User["isBot"];
|
||||||
},
|
},
|
||||||
data: Option,
|
data: Option,
|
||||||
silent = false,
|
silent = false,
|
||||||
|
@ -323,8 +324,8 @@ export default async (
|
||||||
res(note);
|
res(note);
|
||||||
|
|
||||||
// 統計を更新
|
// 統計を更新
|
||||||
notesChart.update(note, true);
|
notesChart.update(note, true, user.isBot);
|
||||||
perUserNotesChart.update(user, note, true);
|
perUserNotesChart.update(user, note, true, user.isBot);
|
||||||
|
|
||||||
// Register host
|
// Register host
|
||||||
if (Users.isRemoteUser(user)) {
|
if (Users.isRemoteUser(user)) {
|
||||||
|
@ -399,6 +400,7 @@ export default async (
|
||||||
// この投稿を除く指定したユーザーによる指定したノートのリノートが存在しないとき
|
// この投稿を除く指定したユーザーによる指定したノートのリノートが存在しないとき
|
||||||
if (
|
if (
|
||||||
data.renote &&
|
data.renote &&
|
||||||
|
!user.isBot &&
|
||||||
(await countSameRenotes(user.id, data.renote.id, note.id)) === 0
|
(await countSameRenotes(user.id, data.renote.id, note.id)) === 0
|
||||||
) {
|
) {
|
||||||
incRenoteCount(data.renote);
|
incRenoteCount(data.renote);
|
||||||
|
|
Loading…
Reference in New Issue