fix (html5): Show chat message notification from html version of the message (instead of markdown)#24421
Conversation
WalkthroughThis change adds support for rendering pre-formatted HTML content in chat messages. The backend service now extracts the Sequence DiagramsequenceDiagram
participant Source as Message<br/>Source
participant Backend as chatMessageStream<br/>(Go)
participant GraphQL as GraphQL<br/>Subscription
participant Frontend as Alert<br/>Component
Source->>Backend: Message with messageProps
activate Backend
Backend->>Backend: Extract messageAsHtml<br/>from messageProps
Backend->>Backend: Build GraphQL payload<br/>with messageAsHtml
deactivate Backend
Backend->>GraphQL: Stream message item<br/>(includes messageAsHtml)
activate GraphQL
GraphQL->>GraphQL: Resolve Message type<br/>with messageAsHtml field
deactivate GraphQL
GraphQL->>Frontend: CHAT_MESSAGE_STREAM<br/>subscription data
activate Frontend
Frontend->>Frontend: mapTextContent()<br/>uses msg.messageAsHtml
Frontend->>Frontend: Strip HTML tags &<br/>unescape for display
deactivate Frontend
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @bbb-graphql-middleware/internal/streaming_server/chatMessageStream.go:
- Line 55: The code uses an unsafe type assertion
messageProps["messageAsHtml"].(string) which can panic if the key is missing or
not a string; update the access in chatMessageStream.go to use the safe
two-value form (v, ok := messageProps["messageAsHtml"]; s, okStr := v.(string))
and provide a sensible default (e.g., empty string) when ok or okStr is false so
messageAsHtml is always a string and no runtime panic occurs.
In
@bigbluebutton-html5/imports/ui/components/chat/chat-graphql/alert/component.tsx:
- Line 132: The code uses msg.messageAsHtml with stripTags and unescapeHtml
which will throw if messageAsHtml is null/undefined; update the expression at
the return site to defensively fallback (e.g., use msg.messageAsHtml || '')
before passing to stripTags/unescapeHtml so it matches patterns elsewhere (see
msg.messageAsHtml, stripTags, unescapeHtml) and prevents runtime errors when the
backend omits or nulls that field.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
bbb-graphql-middleware/internal/streaming_server/chatMessageStream.gobigbluebutton-html5/imports/ui/components/chat/chat-graphql/alert/component.tsxbigbluebutton-html5/imports/ui/components/chat/chat-graphql/alert/queries.ts
⏰ 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). (2)
- GitHub Check: build-package (bbb-html5)
- GitHub Check: build-package (bbb-graphql-server)
🔇 Additional comments (3)
bbb-graphql-middleware/internal/streaming_server/chatMessageStream.go (1)
72-72: Field correctly added to GraphQL payload.The
messageAsHtmlfield is properly included in the item map and will be available to GraphQL subscribers.bigbluebutton-html5/imports/ui/components/chat/chat-graphql/alert/queries.ts (2)
7-7: Interface correctly extended with messageAsHtml field.The
messageAsHtmlfield is properly typed as a string and maintains backward compatibility by keeping the originalmessagefield.
30-30: GraphQL subscription correctly updated to fetch messageAsHtml.The subscription now includes
messageAsHtmlin the selection set, enabling clients to receive the HTML-rendered message content.
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/alert/component.tsx
Show resolved
Hide resolved
Automated tests Summary✅ All the CI tests have passed! |



Currently, chat message notifications display the raw Markdown syntax.
It should instead use the HTML version of the message, which appears correctly without the markdown characters.