forked from mirrors/misskey
fix(backend): リモートのノートのメンション数制限が実際に解決できたユーザー数になっている問題を修正 (#17576)
* fix(backend): リモートのノートのメンション数制限が実際に解決できたユーザー数になっている問題を修正 * Update Changelog
This commit is contained in:
parent
3693adbb2d
commit
420d1f0f95
3 changed files with 6 additions and 1 deletions
|
|
@ -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');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue