メンションの最大数をロールごとに設定可能にする (#13343)

* 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>
This commit is contained in:
Yuriha 2024-02-29 20:48:02 +09:00 committed by GitHub
parent b9bcceddfc
commit 26d4c5fd94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 223 additions and 2 deletions

View file

@ -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(