feat: add confirmation dialog when using @all or @here mentions

KU
2mo ago
+127-8

Description

Implements a confirmation dialog when a user types @all or @here in a message, prompting them before notifying all channel members.

Closes #909

Changes

New admin settings (Admin -> Message):

  • Ask for confirmation when using @all or @here mentions (Message_ConfirmGroupMentions, boolean, default: true) -- enables/disables the feature
    • Minimum members to trigger @all/@here confirmation (Message_ConfirmGroupMentions_MinMembers, int, default: 10) -- only shows the dialog if the room has at least this many members

New flow: processGroupMentionConfirmation

  • Detects @all / @here in the message text
    • Reads room.usersCount from local state (no extra API call)
    • If threshold is met, shows a warning GenericModal asking the user to confirm
    • Send anyway -> message is sent; Cancel -> composer text is restored

Integration

  • Hooked into sendMessage.ts after processTooLongMessage, before slash commands

Screenshots

Modal appearing when sending @all in a 6-member channel:

"Notify all members? -- This message will notify all 6 members of this channel. Are you sure you want to proceed?"

Type of change

  • New feature (non-breaking change which adds functionality)

Summary by CodeRabbit

  • New Features
    • Added confirmation prompts before sending messages containing @all or @here in larger rooms.
    • Users can review the warning, send the message, or cancel and continue editing.
    • Added settings to enable or disable confirmations and configure the minimum room size that triggers them.
  • Localization
    • Added English text for confirmation dialogs, actions, member counts, and configuration options.