# 채팅 메시지를 삭제하면 이전 메시지가 읽지 않음으로 표시됩니다

**URL:** https://meta.discourse.org/t/deleting-a-chat-messages-shows-old-messages-as-unread/263329
**Category:** Bug
**Tags:** chat
**Created:** [4월 30, 2023, 5:00오후 UTC](https://meta.discourse.org/t/deleting-a-chat-messages-shows-old-messages-as-unread/263329 "2023-04-30T17:00:39Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [4월 30, 2023, 5:00오후 UTC](https://meta.discourse.org/t/deleting-a-chat-messages-shows-old-messages-as-unread/263329/1 "2023-04-30T17:00:39Z")

</div>

채팅 메시지를 삭제하거나 다른 채널로 이동한 후 다시 로그인하면, 채팅의 새 메시지 표시기에 X개의 읽지 않은 메시지가 표시됩니다. 이 문제는 모든 사용자에게 발생합니다.

X라는 수치는 처음에는 모든 메시지가 새 메시기로 표시되는 줄 알았지만, 실제로는 그렇지 않았습니다. 그 다음에는 표시기가 그날의 메시지 수를 나타내는 줄로 추측해 보았지만, 그것도 사실이 아니었습니다. 그래서 그 읽지 않은 메시지 수가 어디서 나오는지는 알 수 없는데, 그 수가 터무니없이 큽니다.

정확히 언제부터 그랬는지 말하기는 어렵지만, 3.1.0.beta4([06893d8505](https://github.com/discourse/discourse/commits/06893d8505c81a5f92d9f76ed54fc19e4aacf169))로 업그레이드한 시점부터 그랬을 것이라고 추정합니다.

아니요, 아직 업그레이드를 시도해 보지 않았습니다.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [5월 2, 2023, 2:14오후 UTC](https://meta.discourse.org/t/deleting-a-chat-messages-shows-old-messages-as-unread/263329/2 "2023-05-02T14:14:37Z")

</div>

> [@Jagster](#):
>
> 아니요, 아직 업그레이드를 시도해 본 적이 없습니다.

채팅 기능이 여전히 활발하게 개발되고 있습니다. 재현을 시도하기 전에, 업그레이드 후에도 여전히 문제가 발생하는지 알려주시겠어요?

---

<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: [5월 2, 2023, 2:35오후 UTC](https://meta.discourse.org/t/deleting-a-chat-messages-shows-old-messages-as-unread/263329/3 "2023-05-02T14:35:31Z")

</div>

업그레이드는 필요 없습니다. 최근 발생한 회귀 문제로 생각되며, 이번 주 안에 수정될 가능성이 높습니다.

---

<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: [5월 4, 2023, 3:46오후 UTC](https://meta.discourse.org/t/deleting-a-chat-messages-shows-old-messages-as-unread/263329/5 "2023-05-04T15:46:27Z")

</div>

문제를 파악했으며 원인을 확인했습니다. 내일 수정을 시도하겠습니다 👍

---

<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: [5월 5, 2023, 3:06오후 UTC](https://meta.discourse.org/t/deleting-a-chat-messages-shows-old-messages-as-unread/263329/6 "2023-05-05T15:06:12Z")

</div>

해당 문제를 해결할 것으로 예상되는 수정 사항을 방금 병합했습니다:

> <https://github.com/discourse/discourse/commit/ae3231e1406d4ccf1d048ef8a8d8f744f840896b>
>
> When we were deleting messages in chat, we would find all of
> the UserChatChanne…lMembership records that had a matching
> last\_read\_message\_id and set that column to NULL.
> 
> This became an issue when multiple users had that deleted message
> set to their last\_read\_message\_id. When we called ChannelUnreadsQuery
> to get the unread count for each of the user's channels, we were
> COALESCing the last\_read\_message\_id and returning 0 if it was NULL,
> which meant that the unread count for the channel would be the total
> count of the messages not sent by the user in that channel.
> 
> This was particularly noticeable for DM channels since we show
> the count with the indicator in the header. This issue would disappear
> as soon as the user opened the problem channel, because we would then
> set the last\_read\_message\_id to an actual ID.
> 
> To circumvent this, instead of NULLifying the last\_read\_message\_id in
> most cases, it makes more sense to just set it to the most recent
> non-deleted chat message ID for the channel. The only time it will
> be set to NULL now is when there are no more other messages in the
> channel.

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [5월 5, 2023, 3:42오후 UTC](https://meta.discourse.org/t/deleting-a-chat-messages-shows-old-messages-as-unread/263329/7 "2023-05-05T15:42:11Z")

</div>

간단한 테스트 결과 문제가 없었습니다. 감사합니다!

---

<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: [5월 9, 2023, 3:42오후 UTC](https://meta.discourse.org/t/deleting-a-chat-messages-shows-old-messages-as-unread/263329/8 "2023-05-09T15:42:54Z")

</div>

이 주제는 마지막 답변 후 4일 자동으로 닫혔습니다. 더 이상 새 답변을 게시할 수 없습니다.
