From 26d4c5fd94638e332b93feed8dff749ab5564d6a Mon Sep 17 00:00:00 2001 From: Yuriha <121590760+yuriha-chan@users.noreply.github.com> Date: Thu, 29 Feb 2024 20:48:02 +0900 Subject: メンションの最大数をロールごとに設定可能にする (#13343) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add new role policy: maximum mentions per note * fix * Reviewを反映 * fix * Add ChangeLog * Update type definitions * Add E2E test * CHANGELOG に説明を追加 --------- Co-authored-by: taichan <40626578+tai-cha@users.noreply.github.com> --- packages/backend/src/core/NoteCreateService.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'packages/backend/src/core/NoteCreateService.ts') diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index b412d5db11..727787f868 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -379,6 +379,10 @@ export class NoteCreateService implements OnApplicationShutdown { } } + if (mentionedUsers.length > 0 && mentionedUsers.length > (await this.roleService.getUserPolicies(user.id)).mentionLimit) { + throw new IdentifiableError('9f466dab-c856-48cd-9e65-ff90ff750580', 'Note contains too many mentions'); + } + const note = await this.insertNote(user, data, tags, emojis, mentionedUsers); setImmediate('post created', { signal: this.#shutdownController.signal }).then( -- cgit v1.2.3-freya