Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2021-12-13] [HOLD for payment 2021-12-06] After deleting the last message, editing the next last message doesn't update the message displayed in LHN #3743

Closed
dklymenk opened this issue Jun 24, 2021 · 57 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production External Added to denote the issue can be worked on by a contributor Planning Changes still in the thought process Reviewing Has a PR in review Weekly KSv2

Comments

@dklymenk
Copy link
Contributor

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Send 2 messages (message 1 and message 2) in a chat
  2. Delete the last message (message 2)
  3. Edit the next last message (message 1)

Expected Result:

The LHN should be updated after editing last message regardless of your previous actions

Actual Result:

The LHN is not updated

Workaround:

Sending a new message and editing it updates LHN properly

Platform:

Where is this issue occurring?

Web ✔️
iOS ✔️
Android ✔️
Desktop App ✔️
Mobile Web ✔️

Proposal:

The issue is caused by unreliable values in reportMaxSequenceNumbers in src/libs/actions/Report.js. This array is not updated when you delete a message.

Here is how I would rewrite updateReportActionMessage to update the reportMaxSequenceNumbers.

function updateReportActionMessage(reportID, sequenceNumber, message) {
   const actionToMerge = {};
   actionToMerge[sequenceNumber] = {message: [message]};
   Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, actionToMerge);

   // If this is the most recent message
   if (sequenceNumber === reportMaxSequenceNumbers[reportID]) {
       // If message is deleted we need to update maxSequenceNumber
       if (message.html === '') {
           const connectionID = Onyx.connect({
               key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
               callback: (reportActionList) => {
                   // To make sure the callback is only called once
                   Onyx.disconnect(connectionID);

                   // Find last non-empty message
                   const lastReportAction = !_.isEmpty(reportActionList)
                       ? _.find(Object.values(reportActionList).reverse(),
                           reportAction => _.last(reportAction.message).html !== ''
                           && reportAction.created !== 'CREATED')
                       : null;

                   Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
                       maxSequenceNumber: lastReportAction.sequenceNumber,
                   });
               },
           });
       } else {
           // Update the lastMessageText in the report object
           Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
               lastMessageText: message.html,
           });
       }
   }
}

I would also need to check how other functions across the app interact with maxSequenceNumber to make sure reducing it doesn't break anything.

Version Number: 1.0.68-4
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:

View all open jobs on Upwork

@dklymenk dklymenk added the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jun 24, 2021
@MelvinBot
Copy link

Triggered auto assignment to @strepanier03 (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jun 24, 2021
@NikkiWines
Copy link
Contributor

A note that this issue is related to the changes made in this PR: #3526

@dklymenk
Copy link
Contributor Author

dklymenk commented Jul 2, 2021

Is there any way to push this one forward? It's blocking PR #3526 and all the code is already there, I'm just waiting for a green light to go ahead with the implementation.

@parasharrajat
Copy link
Member

So this is related to changes in #3526 which NikkiWines mentioned above. So I think you are good to go here to submit the PR for this. As this part of old PR.

@parasharrajat
Copy link
Member

But if you are waiting for your solution to be reviewed then waiting is good.

@NikkiWines
Copy link
Contributor

Hmm, it looks like @strepanier03 is out-of-office currently. Going to add the External label so this issue can be triaged appropriately

@NikkiWines NikkiWines added the External Added to denote the issue can be worked on by a contributor label Jul 2, 2021
@MelvinBot
Copy link

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

@MelvinBot MelvinBot added the Daily KSv2 label Jul 2, 2021
@mallenexpensify
Copy link
Contributor

Everything looks good to me, I'm going to assign an engineer to review.

@MelvinBot
Copy link

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

@mallenexpensify
Copy link
Contributor

Job posted https://www.upwork.com/jobs/~01a6f9be9af612f0cd
@iwiznia please review the proposal then assign to to @dklymenk

@mallenexpensify mallenexpensify removed their assignment Jul 2, 2021
@mallenexpensify mallenexpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Jul 2, 2021
@MelvinBot
Copy link

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

@mallenexpensify
Copy link
Contributor

mallenexpensify commented Jul 2, 2021

@puneetlath assigned to you via the External label because I'm out next week. Leaving myself on assignment too, can pick up when back if needed

@mallenexpensify mallenexpensify self-assigned this Jul 2, 2021
@iwiznia
Copy link
Contributor

iwiznia commented Jul 2, 2021

That proposal seems it would work, but I am a bit concerned about the one time connect call to get all actions of the report of the action being updated.
Do you think we could instead put the logic to update the maxSequenceNumber here instead where we should already have all the data available without having to do that one time connect call @dklymenk?

@NikkiWines
Copy link
Contributor

Adding the Help Wanted label, as it looks like we're still accepting new proposals on this one (please remove the label if it's not applicable)

@NikkiWines NikkiWines added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 2, 2021
@mallenexpensify
Copy link
Contributor

So close #3737 (comment)
but... we're on hold for N6 for a week-ish so we likely have a lil while longer to wait.

@mallenexpensify
Copy link
Contributor

Based off #3737 being closed (PR for it), I think we can take this off hold now, right @iwiznia

@MelvinBot MelvinBot removed the Overdue label Sep 28, 2021
@dklymenk
Copy link
Contributor Author

Thanks for bringing it up. Apparently that fix is already deployed too.

I did quick check and my PR #4133 still works. I'm marking it as ready for review now.

@chiragsalian chiragsalian added the Reviewing Has a PR in review label Sep 30, 2021
@dklymenk
Copy link
Contributor Author

Yep, only thing holding the PR for this issue from being merged is the HOLD label on the issue itself. It can 100% be removed now as the fix for #3737 has been merged and deployed and the issue itself is closed.

@mallenexpensify mallenexpensify changed the title [HOLD on #3737] After deleting the last message, editing the next last message doesn't update the message displayed in LHN After deleting the last message, editing the next last message doesn't update the message displayed in LHN Oct 1, 2021
@mallenexpensify
Copy link
Contributor

I took the issue off hold in the title, we're still on n6-hold though so it might take a little bit of time for the PR to get merged, thanks for the patience @dklymenk (and... we'll add a bonus for the hold... once the PR is deployed to production and doesn't have regressions for 7 days)

@kadiealexander
Copy link
Contributor

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.

@mallenexpensify
Copy link
Contributor

n6-hold is lifted, label removed!
@dklymenk can you provide an update on when you'll have a PR ready for review? Thanks

@dklymenk
Copy link
Contributor Author

It's here

#4133

@dklymenk
Copy link
Contributor Author

Ah, there are conflicts again, sorry.

I will resolve those and update the PR within a few hours.

@dklymenk
Copy link
Contributor Author

@mallenexpensify Conflict is fixed and PR is ready to be merged again as far as I am concerned.

@mallenexpensify
Copy link
Contributor

Sorry for the delay @dklymenk , I commented on the PR and removed [HOLD] from the title so we should be good to go.
#4133 (comment)

@botify botify added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 29, 2021
@botify
Copy link

botify commented Nov 29, 2021

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.16-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2021-12-06. 🎊

@botify botify changed the title After deleting the last message, editing the next last message doesn't update the message displayed in LHN [HOLD for payment 2021-12-06] After deleting the last message, editing the next last message doesn't update the message displayed in LHN Nov 29, 2021
@botify botify added Weekly KSv2 and removed Weekly KSv2 labels Dec 6, 2021
@botify botify changed the title [HOLD for payment 2021-12-06] After deleting the last message, editing the next last message doesn't update the message displayed in LHN [HOLD for payment 2021-12-13] [HOLD for payment 2021-12-06] After deleting the last message, editing the next last message doesn't update the message displayed in LHN Dec 6, 2021
@botify
Copy link

botify commented Dec 6, 2021

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.17-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2021-12-13. 🎊

@mallenexpensify
Copy link
Contributor

Paid @dklymenk in Upwork. Thanks for the help!

  • $250 for job
  • $250 for reporting
  • $250 for Company Offsite Hold bonue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production External Added to denote the issue can be worked on by a contributor Planning Changes still in the thought process Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests