From a2e26fb903bb9d725454c5eb586e719677df6caa Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sun, 30 Jun 2024 17:10:46 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=E3=82=B7=E3=83=B3=E3=83=97=E3=83=AB?= =?UTF-8?q?=E3=81=ABstring=E9=85=8D=E5=88=97=E4=BD=BF=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/src/core/NoteCreateService.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 486344d588ea..21e965b41478 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -378,17 +378,16 @@ export class NoteCreateService implements OnApplicationShutdown { || data.reply?.userHost === null || (this.isRenote(data) && this.isQuote(data) && data.renote?.userHost === null) || false; const isAllowedToCreateNotification = () => { - const targetUserIds: string[][] = []; - targetUserIds.push(mentionedUsers.filter(x => x.host == null).map(x => x.id)); - if (data.visibility === 'specified' && data.visibleUsers != null) targetUserIds.push(data.visibleUsers.filter(x => x.host == null).map(x => x.id)); - if (data.reply != null && data.reply.userHost == null) targetUserIds.push([data.reply.userId]); - if (this.isRenote(data) && this.isQuote(data) && data.renote.userHost === null) targetUserIds.push([data.renote.userId]); + const targetUserIds: string[] = [ + ...mentionedUsers.filter(x => x.host == null).map(x => x.id), + ...(data.visibility === 'specified' && data.visibleUsers != null ? data.visibleUsers.filter(x => x.host == null).map(x => x.id) : []), + ...(data.reply != null && data.reply.userHost == null ? [data.reply.userId] : []), + ...(this.isRenote(data) && this.isQuote(data) && data.renote.userHost === null ? [data.renote.userId] : []), + ]; const allowedIds = new Set(meta.nirilaAllowedUnfamiliarRemoteUserIds); - for (const targetUserIds1 of targetUserIds) { - for (const targetUserId of targetUserIds1) { - if (!allowedIds.has(targetUserId)) { - return false; - } + for (const targetUserId of targetUserIds) { + if (!allowedIds.has(targetUserId)) { + return false; } } return true;