improve(backend): Skip note score incrementing when bots reacted (#9367)

fix

Improved code quality

fix

small fix
This commit is contained in:
CyberRex 2022-12-21 10:23:03 +09:00 committed by GitHub
parent bebcaad23b
commit fe158339da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View file

@ -49,13 +49,13 @@ export class NoteDeleteService {
* @param user 稿
* @param note 稿
*/
async delete(user: { id: User['id']; uri: User['uri']; host: User['host']; }, note: Note, quiet = false) {
async delete(user: { id: User['id']; uri: User['uri']; host: User['host']; isBot: User['isBot']; }, note: Note, quiet = false) {
const deletedAt = new Date();
// この投稿を除く指定したユーザーによる指定したノートのリノートが存在しないとき
if (note.renoteId && (await this.noteEntityService.countSameRenotes(user.id, note.renoteId, note.id)) === 0) {
this.notesRepository.decrement({ id: note.renoteId }, 'renoteCount', 1);
this.notesRepository.decrement({ id: note.renoteId }, 'score', 1);
if (!user.isBot) this.notesRepository.decrement({ id: note.renoteId }, 'score', 1);
}
if (note.replyId) {