聊天回复缺少摘录

我最近重建了自托管的 discourse,发现所有聊天回复都丢失了摘录文本。回复头像仍然可见,href ID 也正确,点击可以跳转到正确的帖子。

发布新回复时,发布后会显示摘录,但如果关闭聊天,它会像其他回复一样消失。

3.3.0.beta2-dev (f7a1272fa4)

(据我所知,我没有任何相关的插件或修改会干扰)


         {
            "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\u003earn teh powahz\u003c/p\u003e",
                "excerpt": null,
                "user": {...},
                "chat_webhook_event": null
            },
            "uploads": []
        },
2 个赞

我的开发实例是 3.3.0.beta2-dev (a564274ba2),比您提供的版本早一周,并且没有这个问题。所以我的猜测是它与这个 https://github.com/discourse/discourse/pull/26712 或这个 FIX: build chat message excerpt for thread preview by dbattersby · Pull Request #26765 · discourse/discourse · GitHub 有关。

1 个赞

在我的大约 1000 条聊天消息的案例中,只需更新所有消息以添加摘要即可:

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

但代码修复是在 plugins/chat/app/serializers/chat/in_reply_to_serializer.rb 中添加一个后备:

def excerpt
  object.excerpt || object.build_excerpt
end
1 个赞

感谢您的报告。我已经能够重现此问题,我将对此进行调查并尽快分享修复方案。

2 个赞

此提交应能解决此问题:

3 个赞

此主题已在 3 天后自动关闭。不再允许回复。