App icon indicating copy to clipboard operation
App copied to clipboard

[$500] IOU - New green line appears when delete second IOU

Open lanitochka17 opened this issue 2 years ago • 18 comments

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


**Version Number:**1.4.32-2 **Reproducible in staging?:**Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:

Issue found when executing PR https://github.com/Expensify/App/pull/34011

Action Performed:

  1. Go to FAB> Request money>
  2. Request money from a user that has no existing chat
  3. Click on + button> Request Money> Complete the IOU flow
  4. Delete the last created IOU
  5. Navigate back to the conversation

Expected Result:

Green line should not appears since there is no new message

Actual Result:

New green line appears when delete second IOU

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • [x] Android: Native
  • [x] Android: mWeb Chrome
  • [x] iOS: Native
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/fd6caafc-e53b-415f-a496-afbcb174122c

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01aa6428b2af1b32c9
  • Upwork Job ID: 1750655802310635520
  • Last Price Increase: 2024-01-25

lanitochka17 avatar Jan 25 '24 23:01 lanitochka17

Job added to Upwork: https://www.upwork.com/jobs/~01aa6428b2af1b32c9

melvin-bot[bot] avatar Jan 25 '24 23:01 melvin-bot[bot]

Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] avatar Jan 25 '24 23:01 melvin-bot[bot]

Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee (External)

melvin-bot[bot] avatar Jan 25 '24 23:01 melvin-bot[bot]

We think that this bug might be related to #vip-vsp CC @quinthar

lanitochka17 avatar Jan 25 '24 23:01 lanitochka17

Proposal

Please re-state the problem that we are trying to solve in this issue.

New green line appears when delete second IOU

What is the root cause of that problem?

When we delete the money request, the created field of the REPORTPREVIEW report action is not set correctly.

When we create a money request here, the created of the REPORTPREVIEW will be updated to current timestamp, this is because we want the REPORTPREVIEW to show up as latest message in the main chat report, so the user will notice.

So let's say the main chat has: 1 REPORTPREVIEW: At Jan 24 (initial money request is at Jan 24) 1 comment "What's up": At Jan 25

After the user creates a new money request on Jan 26, the REPORTPREVIEW will jump to Jan 26 and become the latest message. This is correct:

1 comment "What's up": At Jan 25 1 REPORTPREVIEW: At Jan 26

But when deleting a money request that we just created, we don't do anything to the REPORTPREVIEW report action's created time, see here, we revert everything to the previous value before that money request is created, but the created field remains the same.

So after deletion, it will still look like: 1 comment "What's up": At Jan 25 1 REPORTPREVIEW: At Jan 26

Which is wrong, because now when the user clicks on the report preview, they will only see 1 initial money request from Jan 24, and have no idea why they see a report preview on Jan 26 but in the iou report itself, there's nothing happening on Jan 26.

If the user is online, the back-end will send back a created field that is of current timestamp, as if the REPORTPREVIEW was recently created. That timestamp is larger than the last read time of the chat report, so the new green line shows.

What changes do you think we should make in order to solve the problem?

When deleting a money request, we need to revert the created of the report preview to the created time of the latest money request (amongst the remaining ones) in the IOU report. This needs to be done in optimistic data and in back-end as well.

There're some fields in the iouReport that might need to be reverted to that timestamp as well, like lastVisibleActionCreated.

What alternative solutions did you explore? (Optional)

NA

dukenv0307 avatar Jan 26 '24 05:01 dukenv0307

Proposal

Please re-state the problem that we are trying to solve in this issue.

The new green line appears when deleting second IOU

What is the root cause of that problem?

For displaying the new line marker we have a prop shouldDisplayNewMarker which is a combination of a lot of conditions.

To not display the green line we need to remove , i have tested and it wont impact any other things in the App and it will fix the issue as well

_.isEqual(prevProps.report.isDeletedParentAction, nextProps.report.isDeletedParentAction)

What changes do you think we should make in order to solve the problem?

Need to remove the condition i have specified above to make sure it is fixed

What alternative solutions did you explore? (Optional)

NA

cjoshidev avatar Jan 26 '24 05:01 cjoshidev

Gonna put this in #vip-vsp then. @jjcoffee, @dukenv0307 and @cjoshi-zeals - are sure this shouldn't be a BE change like https://github.com/Expensify/App/issues/34190 as well?

twisterdotcom avatar Jan 26 '24 10:01 twisterdotcom

Gonna put this in #vip-vsp then. @jjcoffee, @dukenv0307 and @cjoshi-zeals - are sure this shouldn't be a BE change like https://github.com/Expensify/App/issues/34190 as well?

@twisterdotcom Yes i am pretty sure it wont require any BE changes.

cjoshidev avatar Jan 26 '24 14:01 cjoshidev

This appears to be mostly a BE issue as @dukenv0307 points out in their proposal (the unread indicator also doesn't show if performing the same action offline).

the back-end will send back a created field that is of current timestamp, as if the REPORTPREVIEW was recently created. That timestamp is larger than the last read time of the chat report, so the new green line shows.

I'd say it's also worth fixing the adjacent issue mentioned in the proposal, where ideally the reportPreview should move back up in the chat to its original location.

@cjoshi-zeals Thanks for the proposal, though it could use more detail (see the proposal above for a better example, note that there are links to relevant portions of code that are being referred to). I'm not convinced that removing the condition you mention fixes this issue without causing any regressions.

:ribbon::eyes::ribbon: C+ reviewed

jjcoffee avatar Jan 29 '24 15:01 jjcoffee

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

melvin-bot[bot] avatar Jan 29 '24 15:01 melvin-bot[bot]

@twisterdotcom, @jjcoffee Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Jan 29 '24 16:01 melvin-bot[bot]

I do agree with @jjcoffee, it's mostly a BE issue and should not be handled only in frontend.

We should definitely update the created field to reflect the correct timestamp of the last IOU request before deletion.

I'll handle the backend changes and the frontend changes it'll be easier for me to handle both. @dukenv0307 your proposal LGTM to me thanks, you should have 25% of the reward (cc @twisterdotcom).

lakchote avatar Jan 30 '24 10:01 lakchote

Current assignee @jjcoffee is eligible for the Internal assigner, not assigning anyone new.

melvin-bot[bot] avatar Jan 30 '24 10:01 melvin-bot[bot]

Cool, so @lakchote will push the BE and FE PRs. We'll pay @dukenv0307 $125 for their solution assuming no regression.

twisterdotcom avatar Jan 30 '24 12:01 twisterdotcom

Cool, so @lakchote will push the BE and FE PRs. We'll pay @dukenv0307 $125 for their solution assuming no regression.

@twisterdotcom Sorry I believe in this case usually the contributor will be raising the front-end PR and gets the full reward 😄

I see @lakchote already raised the PR so maybe we can just stick with that, but I think 50% reward is more fair since both the back-end and front-end use my suggested solutions, just that I was not the one (given the chance to) raising the PR...

dukenv0307 avatar Jan 30 '24 16:01 dukenv0307

Cool, so @lakchote will push the BE and FE PRs. We'll pay @dukenv0307 $125 for their solution assuming no regression.

@twisterdotcom Sorry I believe in this case usually the contributor will be raising the front-end PR and gets the full reward 😄

I see @lakchote already raised the PR so maybe we can just stick with that, but I think 50% reward is more fair since both the back-end and front-end use my suggested solutions, just that I was not the one (given the chance to) raising the PR...

It was easier for me to already make the couple lines frontend changes to confirm the backend fix works as expected. Also the majority of the changes are backend related. They are not just one line changes and they also include tests as well.

For these reasons and after gathering external feedback on the matter, I still think 25% of the amount is fair.

lakchote avatar Jan 31 '24 09:01 lakchote

Sure, @lakchote would you mind assigning me to this issue, so later payment can be handled.

Thank you!

dukenv0307 avatar Jan 31 '24 13:01 dukenv0307

ideally the reportPreview should move back up in the chat to its original location

How did we determine that this is the expected behavior? @JmillsExpensify @mountiny what do you guys think? Should we be moving the report preview component backwards when they are deleted? Or would it move to the bottom because it was "updated"?

marcaaron avatar Feb 06 '24 00:02 marcaaron

How did we determine that this is the expected behavior?

IMO the UX is currently confusing, more explanation below (link to proposal). Also we already do such reverted updated date in other places like LHN when comment is deleted.

So after deletion, it will still look like: 1 comment "What's up": At Jan 25 1 REPORTPREVIEW: At Jan 26

Which is wrong, because now when the user clicks on the report preview, they will only see 1 initial money request from Jan 24, and have no idea why they see a report preview on Jan 26 but in the iou report itself, there's nothing happening on Jan 26.

dukenv0307 avatar Feb 06 '24 09:02 dukenv0307

what do you guys think? Should we be moving the report preview component backwards when they are deleted? Or would it move to the bottom because it was "updated"?

Nope I dont think we should move it backwards, quite contrary the deletion is "latest" action done to the expense report so the total changes and attention of the user might be desired so moving it to latest makes more sense than backwards.

But I think not moving it in this case is also fine (if that is what happens now)

mountiny avatar Feb 06 '24 13:02 mountiny

How is this going @dukenv0307?

twisterdotcom avatar Feb 28 '24 12:02 twisterdotcom

@twisterdotcom I was only assigned here for payment as I provided a proposal. Ref here: https://github.com/Expensify/App/issues/35211#issuecomment-1918762559. @lakchote raises the PR to fix this.

dukenv0307 avatar Feb 29 '24 12:02 dukenv0307

Of course! I forgot about this issue. Okay, yeah I see we discussed this here: https://github.com/Expensify/App/issues/35211#issuecomment-1916732326. Sorry for the bump. Now... @lakchote! How we doing??

twisterdotcom avatar Feb 29 '24 14:02 twisterdotcom

No problem.

dukenv0307 avatar Feb 29 '24 14:02 dukenv0307

Of course! I forgot about this issue. Okay, yeah I see we discussed this here: #35211 (comment). Sorry for the bump. Now... @lakchote! How we doing??

The solution suggested by @dukenv0307 did not fit as I had to revert the PR. See @mountiny comment here, we don't want to revert the created action timestamp (further internal discussion ).

It has been handled internally in wave 5 with a different solution (see here. So for this reason, I don't think you should be eligible for payment on this one @dukenv0307? I let @twisterdotcom handle this.

lakchote avatar Mar 04 '24 15:03 lakchote

@lakchote okay, given the solution we were going to pay for wasn't the solution anyway, I think we should just close. I hope you understand this too @dukenv0307!

twisterdotcom avatar Mar 06 '24 16:03 twisterdotcom