mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-13 14:01:13 +08:00
Chat channel oneboxes have been rendering with no icon next to the channel title since #20744. That PR changed the mustache templates to emit `<svg><use href="#d-chat"></use></svg>` and registered a JS-side `replaceIcon("d-chat", "comment")` to compensate. The replacement only runs through `iconHTML()` / `{{icon}}` at render time though — the mustache markup is cooked into the post HTML server-side, so the JS swap never touches it. `d-chat` has never been part of the SVG sprite, which means the browser cannot resolve `#d-chat` and the badge renders empty. This commit pre-renders the channel badge in `Chat::OneboxHandler` and passes it to the templates as a single HTML blob: * When the channel has an emoji, it is rendered via `Emoji.codes_to_img`. * Otherwise we fall back to the chat bubble (`#comment`, which is in the sprite) tinted with the channel's category color. The fix covers all three onebox templates (channel, message, thread). A post-deploy migration flips `baked_version` to 0 on every post whose cooked HTML contains `chat-onebox`, so the recurring `Post.rebake_old` job picks them up and rebakes them in the background with the fixed templates. Ref - t/183234 |
||
|---|---|---|
| .. | ||
| channel_archive_service_spec.rb | ||
| channel_fetcher_spec.rb | ||
| channel_hashtag_data_source_spec.rb | ||
| channel_membership_manager_spec.rb | ||
| core_pretty_text_spec.rb | ||
| duplicate_message_validator_spec.rb | ||
| guardian_extensions_spec.rb | ||
| inline_onebox_handler_spec.rb | ||
| message_bookmarkable_spec.rb | ||
| message_mover_spec.rb | ||
| message_processor_spec.rb | ||
| message_reactor_spec.rb | ||
| messages_exporter_spec.rb | ||
| notifier_spec.rb | ||
| onebox_handler_spec.rb | ||
| parsed_mentions_spec.rb | ||
| post_notification_handler_spec.rb | ||
| review_queue_spec.rb | ||
| slack_compatibility_spec.rb | ||
| statistics_spec.rb | ||
| transcript_service_spec.rb | ||