fix(backend): リモートのノートのメンション数制限が実際に解決できたユーザー数になっている問題を修正 (#17576)

* fix(backend): リモートのノートのメンション数制限が実際に解決できたユーザー数になっている問題を修正

* Update Changelog
This commit is contained in:
かっこかり 2026-06-18 20:35:16 +09:00 committed by GitHub
commit 420d1f0f95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

View file

@ -31,6 +31,7 @@
- Fix: センシティブメディア自動検出周りの依存関係・ファイルの解決に失敗する問題を修正
- Fix: フォロワー限定投稿を指名投稿で引用した際に、引用した投稿の公開範囲が意図せず変更される問題を修正
- Fix: Startup and shutdown failures (port-in-use, socket permission denied, plugin timeouts, leaked WebSocket connections) are now reported through the misskey logger instead of an UnhandledPromiseRejectionWarning stack trace
- Fix: リモートのノートに対するメンション数制限が、サーバーが解決できたユーザー数ベースで行われていた問題を修正
## 2026.5.4

View file

@ -182,6 +182,7 @@ type Option = {
visibleUsers?: MinimumUser[] | null;
channel?: MiChannel | null;
apMentions?: MinimumUser[] | null;
apMentionRawCount?: number | null;
apHashtags?: string[] | null;
apEmojis?: string[] | null;
uri?: string | null;
@ -604,7 +605,8 @@ export class NoteCreateService implements OnApplicationShutdown {
}
}
if (mentionedUsers.length > 0 && mentionedUsers.length > (await this.roleService.getUserPolicies(user.id)).mentionLimit) {
const effectiveMentionCount = Math.max(mentionedUsers.length, data.apMentionRawCount ?? 0);
if (effectiveMentionCount > 0 && effectiveMentionCount > (await this.roleService.getUserPolicies(user.id)).mentionLimit) {
throw new IdentifiableError('9f466dab-c856-48cd-9e65-ff90ff750580', 'Note contains too many mentions');
}

View file

@ -177,6 +177,7 @@ export class ApNoteService {
throw new IdentifiableError('85ab9bd7-3a41-4530-959d-f07073900109', 'actor has been suspended');
}
const apMentionRawCount = new Set(this.apMentionService.extractApMentionObjects(note.tag).map(x => x.href)).size;
const apMentions = await this.apMentionService.extractApMentions(note.tag, resolver);
const apHashtags = extractApHashtags(note.tag);
@ -324,6 +325,7 @@ export class ApNoteService {
visibility,
visibleUsers,
apMentions,
apMentionRawCount,
apHashtags,
apEmojis,
poll,