From c9c28531500b17ea9bd3276c23d8eaae780d446b Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Sun, 23 Dec 2018 03:44:18 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=80=E3=82=A4=E3=83=AC=E3=82=AF=E3=83=88?= =?UTF-8?q?=E3=81=A7=E3=83=A1=E3=83=B3=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=A7?= =?UTF-8?q?=E3=82=82=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=82=92=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=20(#3722)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/endpoints/notes/create.ts | 2 +- src/services/note/create.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/api/endpoints/notes/create.ts b/src/server/api/endpoints/notes/create.ts index fa4388b687..e8c37664f5 100644 --- a/src/server/api/endpoints/notes/create.ts +++ b/src/server/api/endpoints/notes/create.ts @@ -42,7 +42,7 @@ export const meta = { }, visibleUserIds: { - validator: $.arr($.type(ID)).optional.unique().min(1), + validator: $.arr($.type(ID)).optional.unique().min(0), transform: transformMany, desc: { 'ja-JP': '(投稿の公開範囲が specified の場合)投稿を閲覧できるユーザー' diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 248c2372f0..84daa7dfe7 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -182,6 +182,12 @@ export default async (user: IUser, data: Option, silent = false) => new Promise< mentionedUsers.push(u); } } + + for (const u of mentionedUsers) { + if (!data.visibleUsers.some(x => x._id.equals(u._id))) { + data.visibleUsers.push(u); + } + } } const note = await insertNote(user, data, tags, emojis, mentionedUsers);