diff --git a/src/services/count-same-renotes.ts b/src/misc/count-same-renotes.ts similarity index 77% rename from src/services/count-same-renotes.ts rename to src/misc/count-same-renotes.ts index a20b4fbf8ccc10af3601b248b3eb6bd4d934fdff..0233bdf88e11658b8fbcdd3c8669ba826ea75660 100644 --- a/src/services/count-same-renotes.ts +++ b/src/misc/count-same-renotes.ts @@ -1,6 +1,6 @@ import { Notes } from '../models'; -export default async function(userId: string, renoteId: string, excludeNoteId: string | undefined): Promise<number> { +export async function countSameRenotes(userId: string, renoteId: string, excludeNoteId: string | undefined): Promise<number> { // 指定ã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼ã®æŒ‡å®šã—ãŸãƒŽãƒ¼ãƒˆã®ãƒªãƒŽãƒ¼ãƒˆãŒã„ãã¤ã‚ã‚‹ã‹æ•°ãˆã‚‹ const query = Notes.createQueryBuilder('note') .where('note.userId = :userId', { userId }) diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 98b1731802480818b54daefc8bb938bb8002a80c..a10ee5164b841f033b104dc3a6b890f0e157db2a 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -30,7 +30,7 @@ import { isDuplicateKeyValueError } from '../../misc/is-duplicate-key-value-erro import { ensure } from '../../prelude/ensure'; import { checkHitAntenna } from '../../misc/check-hit-antenna'; import { addNoteToAntenna } from '../add-note-to-antenna'; -import countSameRenotes from '../count-same-renotes'; +import { countSameRenotes } from '../../misc/count-same-renotes'; type NotificationType = 'reply' | 'renote' | 'quote' | 'mention'; @@ -237,7 +237,7 @@ export default async (user: User, data: Option, silent = false) => new Promise<N saveReply(data.reply, note); } - //ã“ã®æŠ•ç¨¿ã‚’é™¤ãæŒ‡å®šã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼ã«ã‚ˆã‚‹æŒ‡å®šã—ãŸãƒŽãƒ¼ãƒˆã®ãƒªãƒŽãƒ¼ãƒˆãŒå˜åœ¨ã—ãªã„ã¨ã + // ã“ã®æŠ•ç¨¿ã‚’é™¤ãæŒ‡å®šã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼ã«ã‚ˆã‚‹æŒ‡å®šã—ãŸãƒŽãƒ¼ãƒˆã®ãƒªãƒŽãƒ¼ãƒˆãŒå˜åœ¨ã—ãªã„ã¨ã if (data.renote && (await countSameRenotes(user.id, data.renote.id, note.id) === 0)) { incRenoteCount(data.renote); } diff --git a/src/services/note/delete.ts b/src/services/note/delete.ts index 6561120b49108bd4973b71dd157c8d7d1c286cc2..dc8d23134a6b1f6c6a2bd164cdd4309236fb1580 100644 --- a/src/services/note/delete.ts +++ b/src/services/note/delete.ts @@ -11,7 +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'; +import { countSameRenotes } from '../../misc/count-same-renotes'; /** * 投稿を削除ã—ã¾ã™ã€‚ @@ -21,7 +21,7 @@ import countSameRenotes from '../count-same-renotes'; export default async function(user: User, note: Note, quiet = false) { const deletedAt = new Date(); - //ã“ã®æŠ•ç¨¿ã‚’é™¤ãæŒ‡å®šã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼ã«ã‚ˆã‚‹æŒ‡å®šã—ãŸãƒŽãƒ¼ãƒˆã®ãƒªãƒŽãƒ¼ãƒˆãŒå˜åœ¨ã—ãªã„ã¨ã + // ã“ã®æŠ•ç¨¿ã‚’é™¤ãæŒ‡å®šã—ãŸãƒ¦ãƒ¼ã‚¶ãƒ¼ã«ã‚ˆã‚‹æŒ‡å®šã—ãŸãƒŽãƒ¼ãƒˆã®ãƒªãƒŽãƒ¼ãƒˆãŒå˜åœ¨ã—ãªã„ã¨ã 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);