mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 21:43:45 +08:00
ae3231e140
When we were deleting messages in chat, we would find all of the UserChatChannelMembership 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. |
||
---|---|---|
.. | ||
chat | ||
discourse-details | ||
discourse-lazy-videos | ||
discourse-local-dates | ||
discourse-narrative-bot | ||
discourse-presence | ||
poll | ||
styleguide |