fix(mentions): ignore @everyone and @here in one-to-one DMs (#3199)

This commit is contained in:
Hampus
2026-10-04 16:59:04 +02:00
committed by GitHub
parent 0aeff01c2d
commit 5ca458dada
4 changed files with 51 additions and 3 deletions
@@ -26,7 +26,7 @@ export function createSpecialMentionPayload(kind: SpecialMentionKind): ComposerI
}
export function areSpecialMentionsAllowed(
channel: Pick<Channel, 'guildId' | 'isPersonalNotes'> | null,
channel: Pick<Channel, 'guildId' | 'isGroupDM'> | null,
allowSpecialMentions: boolean | undefined,
allowedTriggers: ReadonlyArray<TriggerType> | undefined,
canMentionEveryone: boolean,
@@ -34,7 +34,7 @@ export function areSpecialMentionsAllowed(
if (channel == null || allowSpecialMentions === false || !isAutocompleteTriggerAllowed('mention', allowedTriggers)) {
return false;
}
return channel.guildId == null ? !channel.isPersonalNotes() : canMentionEveryone;
return channel.guildId == null ? channel.isGroupDM() : canMentionEveryone;
}
export function hasOpenCodeFence(text: string): boolean {
@@ -17,7 +17,7 @@ export function isMentioned(user: User, message: Message): boolean {
return false;
}
const suppressEveryone = UserGuildSettings.isEveryoneMentionSuppressed(channel.guildId ?? null);
const mentionEveryone = message.mentionEveryone && !suppressEveryone;
const mentionEveryone = message.mentionEveryone && !channel.isDM() && !suppressEveryone;
if (mentionEveryone) {
return true;
}