Skip to content

Make sure that we reduce the unread message count when we delete an unread message#6746

Merged
Julesssss merged 2 commits into
mainfrom
yuwen-unreadDeleted
Dec 14, 2021
Merged

Make sure that we reduce the unread message count when we delete an unread message#6746
Julesssss merged 2 commits into
mainfrom
yuwen-unreadDeleted

Conversation

@yuwenmemon

Copy link
Copy Markdown
Contributor

@Julesssss please review
cc @parasharrajat

Details

This will call setLocalLastRead when we see that the message being updated is getting deleted. Also a small change to make a variable name a bit clearer.

Fixed Issues

$ #6472

Tests/QA

  1. From account A, send account B a message. Make sure that Account B is logged in but not viewing the message of accountA
  2. From Account A, delete the message you just sent
  3. From account B, verify that the unread indicator for your app does not show anything

Video:
https://user-images.githubusercontent.com/4741899/145924224-69ac2239-bc67-495c-84db-5b2e8539d62f.mp4


  1. From account A, send account B two messages. Make sure that Account B is logged in but not viewing the messages of accountA
  2. From Account A, delete the first message you just sent
  3. From account B, verify that the unread indicator for your app shows 1

Video:
https://user-images.githubusercontent.com/4741899/145924341-b8f5ea80-1e36-40e5-a832-f1360098e334.mp4


  1. From account A, send account B two messages. Make sure that Account B is logged in but not viewing the messages of accountA
  2. From Account A, delete the second message you just sent
  3. From account B, verify that the unread indicator for your app shows 1

Video:
https://user-images.githubusercontent.com/4741899/145924454-2dc772b3-0dcd-4e90-b759-b1eb6c7dc48e.mp4

@yuwenmemon yuwenmemon requested a review from Julesssss December 14, 2021 02:53
@yuwenmemon yuwenmemon self-assigned this Dec 14, 2021
@yuwenmemon yuwenmemon requested a review from a team as a code owner December 14, 2021 02:53
@MelvinBot MelvinBot requested review from nickmurray47 and removed request for a team December 14, 2021 02:54

@nickmurray47 nickmurray47 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well and lgtm minus one linting change

Comment thread src/libs/actions/Report.js Outdated
Comment on lines +543 to +545
if (!message.text) {
setLocalLastRead(reportID, lastReadSequenceNumbers[reportID]);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this what the linter is looking for?

Suggested change
if (!message.text) {
setLocalLastRead(reportID, lastReadSequenceNumbers[reportID]);
}
if (message.text) {
return;
}
setLocalLastRead(reportID, lastReadSequenceNumbers[reportID]);

@parasharrajat parasharrajat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see the whole code on GH mobile app 🤭. But this function should be called on live delete pusher event.

I think it is but just to be sure.

Comment thread src/libs/actions/Report.js Outdated
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, actionToMerge);
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, actionToMerge).then(() => {
// If the message is deleted, update the last read in case the deleted message is being counted in the unreadActionCount
if (!message.text) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check html instead of text just to be consistent across app.

@yuwenmemon

Copy link
Copy Markdown
Contributor Author

Updated!

@nickmurray47 nickmurray47 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👍 will leave this for Jules to final approve/merge

@Julesssss Julesssss merged commit bfaabd9 into main Dec 14, 2021
@Julesssss Julesssss deleted the yuwen-unreadDeleted branch December 14, 2021 10:48
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by @Julesssss in version: 1.1.20-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @Julesssss in version: 1.1.21-1 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants