Chat replies missing excerpt

AI-generated summary

dsims reported a bug in Discourse 3.3.0.beta2-dev where chat replies no longer display excerpt text, despite the avatar and link working correctly. New replies show excerpts temporarily, but they vanish after closing the chat. The issue appears tied to recent commits (#26712 or #26765), as an older dev instance (a564274ba2) doesn’t exhibit the problem. dsims provided a temporary fix by updating all messages with missing excerpts via console: Chat::Message.where(excerpt: nil).each{|m| m.update(excerpt: m.build_excerpt) }, and suggested a code fix in in_reply_to_serializer.rb to fallback to build_excerpt if excerpt is nil. davidb confirmed the issue and provided a fix via commit c1f6ec5f62, which addresses the missing excerpt by ensuring fallback logic in serialization.

I recently rebuilt my self-hosted discourse and I see now that all chat replies lost the excerpt text. The reply-to avatar is still visible though and the href id is correct and clicking takes you to the correct post.

Making a new reply shows the excerpt after posting, but if you close the chat it disappears like the others.

3.3.0.beta2-dev (f7a1272fa4)

(I have no related plugins or modifications to interfere AFAIK)


         {
            "id": 1892,
            "message": "testing reply",
            "cooked": "\u003cp\u003etesting reply\u003c/p\u003e",
            "created_at": "2024-04-29T19:02:11Z",
            "excerpt": "testing reply",
            "chat_channel_id": 2,
            "streaming": false,
            "user": {...},
            "mentioned_users": [],
            "available_flags": [],
            "chat_webhook_event": null,
            "in_reply_to": {
                "id": 1880,
                "cooked": "\u003cp\u003eearn teh powahz\u003c/p\u003e",
                "excerpt": null,
                "user": {...},
                "chat_webhook_event": null
            },
            "uploads": []
        },
2 Likes

My dev instance is a week older on 3.3.0.beta2-dev (a564274ba2) and doesn’t have this problem. So my guess is it has something to do with this https://github.com/discourse/discourse/pull/26712 or this FIX: build chat message excerpt for thread preview by dbattersby · Pull Request #26765 · discourse/discourse · GitHub

1 Like

In my case of only ~1000 chat messages, it was simple to just update them all to add the excerpt:

Chat::Message.where(excerpt: nil).each{|m| m.update(excerpt: m.build_excerpt) };0

But a code fix would be to add a fallback to plugins/chat/app/serializers/chat/in_reply_to_serializer.rb

def excerpt
  object.excerpt || object.build_excerpt
end
1 Like

Thank you for reporting. I have been able to repro this issue, I will look into this and share a fix soon.

2 Likes

This should be fixed with this commit:

https://github.com/discourse/discourse/commit/c1f6ec5f62a8406cdb1284637b3681d14e93b4e3

3 Likes

This topic was automatically closed after 3 days. New replies are no longer allowed.