App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-12-06] Unread messages - Unread messages count includes deleted messages

Open isagoico opened this issue 5 years ago • 28 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Login with 2 accounts side by side
  2. Tag a comment as unread and mark the count of unread comments
  3. Delete some comments from the sender's account
  4. Refresh the page
  5. Mark the same comment as you did in step 2. Observe the count is still the same even though the messages on screen are less

Expected Result:

If the comment was deleted it should not be included in the unread messages count.

Actual Result:

Comment that was deleted is included in the message count.

Workaround:

Not sure (🤔)

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.0.98-0

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

https://user-images.githubusercontent.com/44479856/133168079-a4fe5b71-5488-4dbb-92ae-d36ae02472a5.mp4

Expensify/Expensify Issue URL:

Issue reported by: @kidroca Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1631549737202800

View all open jobs on GitHub

isagoico avatar Sep 13 '21 23:09 isagoico

Triggered auto assignment to @robertjchen (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Sep 13 '21 23:09 MelvinBot

Triggered auto assignment to @mallenexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Sep 28 '21 08:09 MelvinBot

Looks like a perfect task for a contributor to tackle!

robertjchen avatar Sep 28 '21 08:09 robertjchen

Job posted https://www.upwork.com/jobs/~01143b9e85d8cc1924

mallenexpensify avatar Sep 29 '21 00:09 mallenexpensify

Triggered auto assignment to @puneetlath (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

MelvinBot avatar Sep 29 '21 00:09 MelvinBot

Doubled to $500

mallenexpensify avatar Oct 07 '21 21:10 mallenexpensify

Please refer to this post for updated information on the n6 hold, we've raised the bonus to $250 for all issues where a PR is created before the N6 hold is lifted.

kadiealexander avatar Oct 08 '21 01:10 kadiealexander

Proposal

  1. We are not filtering the deleted messages (where a deleted action is action.html = '').

https://github.com/Expensify/App/blob/a860c59f9f7bd667f005aea269ec6fe6aa696b50/src/libs/actions/Report.js#L107

  1. We can get the report actions and then count the deleted messages that lie between the latest and lastReadSequenceNumber.
let deletedmessages = 0;
				const handle =Onyx.connect({
                    key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
                    callback: (reportActionList) => {
                    Onys.disconnect(handle);
                    _.chain(reportActions)
           			 .sortBy('sequenceNumber')
           			 .each((action) => {
              		
                // Empty ADDCOMMENT actions typically mean they have been deleted 
                const message = _.first(lodashGet(action, 'message', null));
                const html = lodashGet(message, 'html', '');
                if(action.sequenceNumber >= lastReadSequenceNumber && action.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT && html !== ''){
              			deletedmessages++;
              		}
            });
                    
  1. remove the calculated count of deleted messages from the unreadActionCount in Step 1.

parasharrajat avatar Oct 08 '21 16:10 parasharrajat

@mallenexpensify Rajat's proposal sounds good to me.

puneetlath avatar Oct 15 '21 20:10 puneetlath

@parasharrajat can apply and confirm here once you have? Thanks https://www.upwork.com/jobs/~01143b9e85d8cc1924

mallenexpensify avatar Oct 19 '21 15:10 mallenexpensify

@mallenexpensify Done.

parasharrajat avatar Oct 19 '21 15:10 parasharrajat

@parasharrajat is hired! Assigned to him

mallenexpensify avatar Oct 19 '21 15:10 mallenexpensify

n6-hold is lifted, label removed!

mallenexpensify avatar Oct 20 '21 12:10 mallenexpensify

PR would be up by next week.

parasharrajat avatar Oct 22 '21 20:10 parasharrajat

@parasharrajat Can you provide an update on when we can expect the PR? Thanks

mallenexpensify avatar Nov 02 '21 01:11 mallenexpensify

I have started on it. It would be ready soon. I was busy last week.

parasharrajat avatar Nov 02 '21 01:11 parasharrajat

I would like to ask how the Mark as unread functionality works. e.g. I marked the five latest messages as unread. image Now this includes messages from the Other user as well. What should be the unread message count?

parasharrajat avatar Nov 06 '21 12:11 parasharrajat

@parasharrajat in the screenshot are you a different user? ie. are there 3 users in a group chat? Regardless.. I have a feeling we're going to want to raise the question in #expensify-open-source to gain consensus.

mallenexpensify avatar Nov 08 '21 20:11 mallenexpensify

Awaiting review....

parasharrajat avatar Nov 14 '21 16:11 parasharrajat

@puneetlath can you review the PR please https://github.com/Expensify/App/pull/6248

mallenexpensify avatar Nov 15 '21 20:11 mallenexpensify