同じノートを何回リノートしても一回として数えるように (#6086)
* 同じノートを何回リノートしても一回として数えるように * Update count-same-renotes.ts Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
parent
241769d6fc
commit
f6c376f20d
3 changed files with 21 additions and 2 deletions
|
@ -11,6 +11,7 @@ import { Note } from '../../models/entities/note';
|
|||
import { Notes, Users, Instances } from '../../models';
|
||||
import { notesChart, perUserNotesChart, instanceChart } from '../chart';
|
||||
import { deliverToFollowers } from '../../remote/activitypub/deliver-manager';
|
||||
import countSameRenotes from '../count-same-renotes';
|
||||
|
||||
/**
|
||||
* 投稿を削除します。
|
||||
|
@ -20,7 +21,8 @@ import { deliverToFollowers } from '../../remote/activitypub/deliver-manager';
|
|||
export default async function(user: User, note: Note, quiet = false) {
|
||||
const deletedAt = new Date();
|
||||
|
||||
if (note.renoteId) {
|
||||
//この投稿を除く指定したユーザーによる指定したノートのリノートが存在しないとき
|
||||
if (note.renoteId && (await countSameRenotes(user.id, note.renoteId, note.id)) === 0) {
|
||||
Notes.decrement({ id: note.renoteId }, 'renoteCount', 1);
|
||||
Notes.decrement({ id: note.renoteId }, 'score', 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue