Skip to content

feat: confirm group mentions before sending#40941

Open
adityasingh6533 wants to merge 1 commit into
RocketChat:developfrom
adityasingh6533:feat/confirm-group-mentions
Open

feat: confirm group mentions before sending#40941
adityasingh6533 wants to merge 1 commit into
RocketChat:developfrom
adityasingh6533:feat/confirm-group-mentions

Conversation

@adityasingh6533

@adityasingh6533 adityasingh6533 commented Jun 13, 2026

Copy link
Copy Markdown

This PR adds a configurable confirmation step before sending messages that mention @all or @here.

When the new Message_ConfirmGroupMentions setting is enabled, users are shown a warning modal before the message is sent. If they cancel or close the modal, the message is not sent. If they confirm, the message continues through the normal send flow.

The setting is enabled by default and can be managed from the Message settings section.

Issue(s)

Closes #909

How to test

  1. Start the app and log in as an admin.
  2. Go to Administration > Workspace > Settings > Message.
  3. Make sure Confirm @ALL and @here mentions is enabled.
  4. Open any room and type a message containing @all or @here.
  5. Verify that a confirmation modal is shown before sending.
  6. Click Cancel or close the modal and verify that the message is not sent.
  7. Send the message again and click Send anyway.
  8. Verify that the message is sent normally.
  9. Disable Confirm @ALL and @here mentions.
  10. Send another message containing @all or @here.
  11. Verify that the message is sent without showing the confirmation modal.

Screenshots

N/A

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added a confirmation modal that prompts users when sending messages containing group mentions (all or here). Users must explicitly confirm before the message is delivered to all participants.
    • Added a new admin-configurable setting to enable or disable group mention confirmation for enhanced moderation control.

@adityasingh6533 adityasingh6533 requested review from a team as code owners June 13, 2026 03:29
@changeset-bot

changeset-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2277d56

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dionisio-bot

dionisio-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ec4c8053-5f0a-4b3b-961d-cd6fe046312f

📥 Commits

Reviewing files that changed from the base of the PR and between a080c80 and 2277d56.

📒 Files selected for processing (4)
  • apps/meteor/client/lib/chats/flows/processGroupMentionConfirmation.ts
  • apps/meteor/client/lib/chats/flows/sendMessage.ts
  • apps/meteor/server/settings/message.ts
  • packages/i18n/src/locales/en.i18n.json
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/server/settings/message.ts
  • apps/meteor/client/lib/chats/flows/processGroupMentionConfirmation.ts
  • apps/meteor/client/lib/chats/flows/sendMessage.ts
🧠 Learnings (5)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/server/settings/message.ts
  • apps/meteor/client/lib/chats/flows/processGroupMentionConfirmation.ts
  • apps/meteor/client/lib/chats/flows/sendMessage.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/server/settings/message.ts
  • apps/meteor/client/lib/chats/flows/processGroupMentionConfirmation.ts
  • apps/meteor/client/lib/chats/flows/sendMessage.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/server/settings/message.ts
  • apps/meteor/client/lib/chats/flows/processGroupMentionConfirmation.ts
  • apps/meteor/client/lib/chats/flows/sendMessage.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/lib/chats/flows/processGroupMentionConfirmation.ts
  • apps/meteor/client/lib/chats/flows/sendMessage.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.

Applied to files:

  • apps/meteor/client/lib/chats/flows/processGroupMentionConfirmation.ts
  • apps/meteor/client/lib/chats/flows/sendMessage.ts
🔇 Additional comments (4)
apps/meteor/client/lib/chats/flows/processGroupMentionConfirmation.ts (1)

1-34: LGTM!

apps/meteor/client/lib/chats/flows/sendMessage.ts (1)

12-12: LGTM!

Also applies to: 19-31, 35-35, 40-40, 50-50, 63-63, 117-119

apps/meteor/server/settings/message.ts (1)

168-172: LGTM!

packages/i18n/src/locales/en.i18n.json (1)

1258-1260: LGTM!

Also applies to: 3535-3536


Walkthrough

This PR introduces a group mention confirmation feature that prompts users before sending messages containing @all or @here notifications. The feature includes a new admin setting, a client-side confirmation modal, integration into the message sending flow, and English localization strings.

Changes

Group Mention Confirmation

Layer / File(s) Summary
Group mention detection and confirmation modal
apps/meteor/client/lib/chats/flows/processGroupMentionConfirmation.ts
Exported function detects @all/@here mentions via regex and returns Promise<boolean>. If confirmation is disabled in settings, resolves immediately as true. If enabled and match found, opens an imperative GenericModal that resolves true on user confirmation and false on dismissal.
Message sending flow refactor
apps/meteor/client/lib/chats/flows/sendMessage.ts
Refactored internal process function to return Promise<boolean> with explicit true/false outcomes for all early-exit paths (reactions, too-long messages, group mention confirmation, slash commands, uploads). Updated sendMessage caller to guard on process result and return early if false.
Admin setting and localization
apps/meteor/server/settings/message.ts, packages/i18n/src/locales/en.i18n.json
Added Message_ConfirmGroupMentions boolean setting with i18n description; added four English locale keys for the confirmation modal prompt and the feature's admin label and description.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

type: feature

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately captures the primary objective: adding a configurable confirmation step before sending messages with @all/@here mentions.
Linked Issues check ✅ Passed All code changes directly implement the core requirement from issue #909: a settings-based confirmation prompt before sending @all notifications, including the setting registration, UI modal, and flow control.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the group mention confirmation feature; no unrelated modifications to other functionality were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added the type: feature Pull requests that introduces new feature label Jun 13, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Re-trigger cubic

@adityasingh6533

Copy link
Copy Markdown
Author

please merge mine pull request i have fix the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community type: feature Pull requests that introduces new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings for confirmation for using @all notification on messages

1 participant