# 标记已读聊天消息时出现问题

**URL:** https://meta.discourse.org/t/issue-with-mark-as-read-chat-message/259825
**Category:** Bug
**Tags:** chat
**Created:** [2023年三月29日 09:55 UTC](https://meta.discourse.org/t/issue-with-mark-as-read-chat-message/259825 "2023-03-29T09:55:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [2023年三月29日 09:55 UTC](https://meta.discourse.org/t/issue-with-mark-as-read-chat-message/259825/1 "2023-03-29T09:55:39Z")

</div>

您好，

我们社区曾有关于聊天消息已读状态未正确工作的报告。即使他们阅读了频道中的所有消息，未读徽章仍然存在。今天我们终于弄清楚了原因。

重现步骤：

1. 在频道中用 `userA` 发送一条消息。（未读徽章会显示给 `userB`（非员工））
2. 作为员工删除 `userA` 发送的消息。
3. 用 `userB` 打开频道。（`userB` 无法阅读该消息，未读徽章也不会消失。即使尝试使用 `Shift` + `Esc` 组合键也无效。）

似乎当频道最新消息被员工删除时，就会发生这种情况。如果新消息进来，未读徽章就会消失。

谢谢 🙂

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2023年三月29日 10:26 UTC](https://meta.discourse.org/t/issue-with-mark-as-read-chat-message/259825/3 "2023-03-29T10:26:32Z")

</div>

是的，我们内部有一个关于此问题的工单，下周可能会修复 👍

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2023年四月13日 08:01 UTC](https://meta.discourse.org/t/issue-with-mark-as-read-chat-message/259825/5 "2023-04-13T08:01:24Z")

</div>

我相信这已在以下位置修复：

> <https://github.com/discourse/discourse/pull/20912>
>
> When a chat message is trashed and the message is used
> for someone's UserChatCh…annelMembership#last\_read\_message\_id,
> the user would end up with some read state issues until
> someone posted a new message in the channel, since we didn't
> clear it like we did on bulk message delete.
> 
> This commit fixes the issue, and also takes the opportunity
> to start a MessagesController in the API namespace, and move
> the trash message functionality into the new service format.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2023年四月14日 05:00 UTC](https://meta.discourse.org/t/issue-with-mark-as-read-chat-message/259825/6 "2023-04-14T05:00:31Z")

</div>

此主题已在 20 小时后自动关闭。不再允许回复。
