Skip to content

[CLNP-6501][fix]: disable mentions and sanitize HTML in edit mode#1418

Open
sf-tyler-jeong wants to merge 1 commit intomainfrom
fix/clnp-6501
Open

[CLNP-6501][fix]: disable mentions and sanitize HTML in edit mode#1418
sf-tyler-jeong wants to merge 1 commit intomainfrom
fix/clnp-6501

Conversation

@sf-tyler-jeong
Copy link
Copy Markdown

@sf-tyler-jeong sf-tyler-jeong commented Apr 13, 2026

Description

Fixes two issues in message edit mode:

  1. Mention suggestion list shown in edit mode — The SuggestedMentionListView appeared when typing @ in edit mode, even though mentions are not functional during editing. Fixed by setting isMentionEnabled={false} on MessageInput in edit mode, which disables mention detection and prevents the suggestion list from appearing.

  2. HTML tag injection via contentEditable — The mentionTemplate passed to onUpdateMessage was not sanitized, allowing HTML tags to be included in the edited message. Fixed by applying sanitizeString() to mentionTemplate in the editMessage function.

Root Cause

  • MessageInput in edit mode had isMentionEnabled={groupChannel.enableMention}, enabling mention detection even though edit mode does not support adding new mentions.
  • editMessage function passed raw mentionTemplate from extractTextAndMentions() without sanitization.

Changes

File Change
src/modules/GroupChannel/components/Message/MessageView.tsx Set isMentionEnabled={false} for MessageInput in edit mode
src/ui/MessageInput/index.tsx Apply sanitizeString() to mentionTemplate in editMessage

Ticket

Mentions are not functional in edit mode, so disable mention detection
by setting isMentionEnabled={false} on MessageInput. Also sanitize
mentionTemplate in editMessage to prevent HTML tag injection via
contentEditable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 13, 2026

Deploy Preview for sendbird-uikit-react ready!

Name Link
🔨 Latest commit 7f248bd
🔍 Latest deploy log https://app.netlify.com/projects/sendbird-uikit-react/deploys/69dca5126339d1000874c9fa
😎 Deploy Preview https://deploy-preview-1418--sendbird-uikit-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f248bd516

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

ref={editMessageInputRef}
mentionSelectedUser={selectedUser}
isMentionEnabled={groupChannel.enableMention}
isMentionEnabled={false}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve existing mentions when editing mentioned messages

Setting isMentionEnabled to false in edit mode makes MessageInput take its mention-disabled initialization path, so a previously mentioned message is loaded as plain text instead of mention-label nodes; when the user saves, extractTextAndMentions() no longer emits @{userId} tokens and onUpdateMessage sends a non-mention template. In practice, editing even a typo in a message that already mentions users will silently strip those mentions from the updated message.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant