Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

fix: Deletion of 1st message in a thread causes notification to be up without showing why.

Open Gustrb opened this issue 1 year ago • 4 comments

Proposed changes (including videos or screenshots)

This PR fixes the issue that would arise all the times the first (and only) message of a thread would get deleted. What was happening is that, we were not checking, on deletion, if all the messages of a thread had been deleted, which was making the UI feel unresponsive, since the 'Following' bell would show as if there were unread messages even if the message was deleted. So, now, we do a couple checks to ensure consistency:

  1. We decrease the counter of the number of thread messages in the parent message
  2. We remove unread from the subscription of the deleted message, and, if some message was updated, we notify the client to refresh that data.
  3. If the number of thread messages of the parent message is 0, we also notify the client to update the parent message, so we avoid showing that there are 1 thread message even if it was deleted.

Issue(s)

Steps to test or reproduce

You are going to need two users, let's call them user A and B, they both must be at the same room for you to be able to test.

  1. As user A send a message in the room
  2. As user B add a thread message in the room
  3. As user B remove the thread message
  4. Click on the user A browser so the websocket update takes place

Expected:

  • The thread should show the "View thread" button, and it show there is 0 replies, and there should be no visual representation of an unread message

Further comments

CONN-261

Gustrb avatar Dec 11 '24 19:12 Gustrb

Looks like this PR is ready to merge! 🎉 If you have any trouble, please check the PR guidelines

dionisio-bot[bot] avatar Dec 11 '24 19:12 dionisio-bot[bot]

🦋 Changeset detected

Latest commit: 09754f6f41cb8d36c010543b2695d8b3f2e8375a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 35 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/network-broker Patch
@rocket.chat/models Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Dec 11 '24 19:12 changeset-bot[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 75.27%. Comparing base (ff04c19) to head (09754f6). Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           develop   #34165       +/-   ##
============================================
+ Coverage    59.28%   75.27%   +15.99%     
============================================
  Files         2820      516     -2304     
  Lines        67932    22540    -45392     
  Branches     15102     5485     -9617     
============================================
- Hits         40275    16968    -23307     
+ Misses       24831     4911    -19920     
+ Partials      2826      661     -2165     
Flag Coverage Δ
e2e ?
e2e-api ?
unit 75.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

codecov[bot] avatar Dec 11 '24 19:12 codecov[bot]

PR Preview Action v1.4.8 :---: :rocket: Deployed preview to https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-34165/ on branch gh-pages at 2024-12-20 20:46 UTC

github-actions[bot] avatar Dec 11 '24 19:12 github-actions[bot]