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 2023-07-26] [$1000] Chat - Inconsistent behavior on deleting message that have reply/thread #21103

Closed
2 of 6 tasks
kbecciv opened this issue Jun 20, 2023 · 76 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Jun 20, 2023

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. Go to any chat on new.expensify.com
  2. Write and send a message
  3. Reply to your own message, it will lead you to thread page(good)
  4. Go back to conversation page and delete the message
  5. It says "[deleted message] 1 reply" (good), delete that message again.
  6. It will remove the [deleted message] with the 1 reply temporarily, then go to the thread that is created when you reply to the message
  7. Go back to the conversation, observe the "[deleted message]" reappeared(bad)
    Note that: I am not saying the deleted message is reappearing but the label "[deleted message]" is appearing again after it is deleted

Expected Result:

When the [deleted message] is deleted it should permanently be not shown, or it always shouldn't allow the label [deleted message] to be deleted based on Expensify rule. At least, it should be consistent.

Actual Result:

Now, it is not consistent. When you delete the "[deleted message]" label in the conversation it will delete temporarily, then after you get in to the thread and get back to the conversation you will see it reappearing.

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

**Version Number:**1.3.28-5

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

Notes/Photos/Videos: Any additional supporting documentation

Screenshare.-.2023-06-13.11_18_59.AM.1.mp4
Recording.784.mp4

Expensify/Expensify Issue URL:

Issue reported by: @KALLL

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1686645553886709

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019b1d6662d4b09fb2
  • Upwork Job ID: 1671865093908606976
  • Last Price Increase: 2023-06-22
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 20, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@hungvu193
Copy link
Contributor

hungvu193 commented Jun 20, 2023

Proposal

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

Chat - Inconsistent behavior on deleting message that have reply/thread

What is the root cause of that problem?

We are checking condition to show the Delete button inside ContextMenu here:

shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport, reportID) =>
// Until deleting parent threads is supported in FE, we will prevent the user from deleting a thread parent
type === CONTEXT_MENU_TYPES.REPORT_ACTION &&
ReportUtils.canDeleteReportAction(reportAction, reportID) &&
!isArchivedRoom &&
!isChronosReport &&
!ReportActionUtils.isMessageDeleted(reportAction),

In this case, after message is deleted, we deleted the reportAction by updating the optimisticData to this:

    const deletedMessage = [
        {
            type: 'COMMENT',
            html: '',
            text: '',
            isEdited: true,
            isDeletedParentAction: true,
        },
    ];

But in isMessageDeleted we are checking isDeletedParentAction inside originalMessage

function isMessageDeleted(reportAction) {
    return lodashGet(reportAction, 'originalMessage.isDeletedParentAction', false);
}

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

We should also update the originalMessage's isDeletedParentAction property to true in our optimisticReportActions data in here
Something like this:

    const optimisticReportActions = {
        [reportActionID]: {
            pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
            previousMessage: reportAction.message,
            message: deletedMessage,
            originalMessage: {
                isDeletedParentAction: true,
                html: '',
                text: '',
            },
            errors: null,
        },
    };

What alternative solutions did you explore? (Optional)

We can also use the message prop to identify if the message is deleted or not

function isMessageDeleted(reportAction) {
    return lodashGet(reportAction, ['message', 0, 'isDeletedParentAction'], false);
}

@joekaufmanexpensify
Copy link
Contributor

i can reproduce this. I think this is related to the above issue. Sense checking next steps here.

@joekaufmanexpensify
Copy link
Contributor

Still determining next steps

@joekaufmanexpensify
Copy link
Contributor

Was advised on the other issue, that this one was out of scope there. Here is my reproduction of this bug. For expected behavior, once you delete a parent thread message. We should immediately change the comment actions menu to show only "reply in thread" and "mark Unread", which is what is shows once you leave the leave the chat and come back.

2023-06-20_16-43-23.mp4

@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label Jun 22, 2023
@melvin-bot melvin-bot bot changed the title Chat - Inconsistent behavior on deleting message that have reply/thread [$1000] Chat - Inconsistent behavior on deleting message that have reply/thread Jun 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 22, 2023

Job added to Upwork: https://www.upwork.com/jobs/~019b1d6662d4b09fb2

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 22, 2023

Current assignee @joekaufmanexpensify is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jun 22, 2023

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

@joekaufmanexpensify
Copy link
Contributor

@fedirjh thoughts on the above proposal?

@fedirjh
Copy link
Contributor

fedirjh commented Jun 24, 2023

@joekaufmanexpensify @aimane-chnaif @dhairyasenjaliya I think this is a regression from #20460 , Specifically this line

return lodashGet(reportAction, 'originalMessage.isDeletedParentAction', false);

We should use the message prop to identify if the message is deleted or not, similar to this line

const isDeletedParentAction = lodashGet(reportAction, ['message', 0, 'isDeletedParentAction'], false);

Why ?

When we delete a message the server response includes only the message prop

Screenshot 2023-06-24 at 1 09 40 PM

When we check if the message is deleted it will fail

Screenshot 2023-06-24 at 1 11 09 PM

In the other hand the OpenReport command include both props and that explain why the context menu updates after we navigate back from the thread , because new OpenReport command is triggered ...

Screenshot 2023-06-24 at 1 13 20 PM

Solution

update isMessageDeleted to

function isMessageDeleted(reportAction) {
    return lodashGet(reportAction, ['message', 0, 'isDeletedParentAction'], false);
}

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Jun 24, 2023

@fedirjh why do you think it's a regression? Did you test this issue before that PR and confirm it was working?
Context menu actions always appeared on Step 5 so never worked before.

And that was original logic. We just generalized that from download action to all actions.
https://github.com/Expensify/App/pull/20460/files#diff-c352943cfbc37be8eb6e327927c6f50b353de8481ea7bc0bc1d40776513a301dL98
This condition was added originally in #19769

@fedirjh
Copy link
Contributor

fedirjh commented Jun 24, 2023

why do you think it's a regression?

This case should have been handled in that PR. The PR introduced a new method and that method is causing this issue. From the context of that PR , when we delete message, we should hide other actionable item, The test included in he PR will not cover this case, in fact it hides it. We should have included another test inside the parent report, if we delete a comment inside a report it should immediately hide other context menu items.

We just generalized that from download action to all actions.

hmm but we generalized the wrong code.

@aimane-chnaif
Copy link
Contributor

This issue was reported on June 13.
Our PR was merged on June 15.
So not regression.

@aimane-chnaif
Copy link
Contributor

There are 3 issues related to parent message deletion.
1.Deleting parent message on thread chat doesn't update immediately (before refresh) - #19363
2.Deleting parent message on parent chat doesn't update context menu immediately (before refresh) - #21103
3.Deleted parent message (both on thread chat and parent chat) is still deletable from context menu (after refresh) - #20074

As all of these have different root causes, it's fine these issues are handled separately. But I agree it would have been better if #20074 covered #21103 as well.

@fedirjh
Copy link
Contributor

fedirjh commented Jun 24, 2023

This issue was reported on June 13.

My analysis is based on @joekaufmanexpensify's comment here #21103 (comment) which provide an updated expected result based on the merged PR.

@fedirjh
Copy link
Contributor

fedirjh commented Jun 24, 2023

As all of these have different root causes, it's fine these issues are handled separately. But I agree it would have been better if #20074 covered #21103 as well.

I am fine with handling it separately in this issue given that the original issue was reported before the PR is merged.

@hungvu193
Copy link
Contributor

There's another dupe of this issue here: #21532

@joekaufmanexpensify
Copy link
Contributor

Yeah @techievivek and I chatted about this and are cool to treat this like a separate issue, rather than a regression.

@hungvu193
Copy link
Contributor

@MonilBhavsar @fedirjh #22956 is now ready for review!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 19, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Chat - Inconsistent behavior on deleting message that have reply/thread [HOLD for payment 2023-07-26] [$1000] Chat - Inconsistent behavior on deleting message that have reply/thread Jul 19, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.42-26 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 2023-07-26. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jul 19, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

@joekaufmanexpensify
Copy link
Contributor

@fedirjh Could you please complete your portion of the BZ checklist so we can prep to issue payment here?

@fedirjh
Copy link
Contributor

fedirjh commented Jul 25, 2023

BugZero Checklist:

  1. Send any message in any chat room
  2. Thread that message
  3. Send any message on that thread
  4. Return to Parent Report
  5. Delete the threaded message
  6. Hover over [Deleted message]
  7. Verify that context menu shows only "Mark as unread" icon, no other icons show

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 25, 2023
@joekaufmanexpensify
Copy link
Contributor

BZ checklist is now complete, all set to issue payment. @hungvu193 was assigned on 2023-07-14, and the PR was merged on 2023-07-17. The 15th and 16th were weekend days, so the PR was merged in ~1 business day and qualifies for a bonus. So we need to make the following payments:

@joekaufmanexpensify
Copy link
Contributor

@hungvu193 $1,500 sent and contract ended!

@hungvu193
Copy link
Contributor

@hungvu193 $1,500 sent and contract ended!

Thank you! 😄

@joekaufmanexpensify
Copy link
Contributor

@KALLL It looks like our automation incorrectly sent you two offers for this job in Upwork. I see the first automatically paid you $250 for the reporting bonus here on 2023-07-14. So I've gone ahead and closed out the second with no payment.

Please let us know if you have any questions. Thanks!

@joekaufmanexpensify
Copy link
Contributor

@KALLL you should have been sent an escrow refund request for $250 for the duplicate payment, since we ended the contract with no payment. Please confirm here once you've accepted it. Thanks!

I also went ahead and ended the contract for which you received your $250 payment as well!

@joekaufmanexpensify
Copy link
Contributor

@fedirjh could you please accept our offer here so we can pay you? Thanks!

@fedirjh
Copy link
Contributor

fedirjh commented Jul 26, 2023

@joekaufmanexpensify Thank you. Accepted

@joekaufmanexpensify
Copy link
Contributor

Great, thanks! @fedirjh $1,500 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed.

@joekaufmanexpensify
Copy link
Contributor

Bug is fixed, BZ checklist complete, and all payment issued. Closing as this is all set. Thanks everyone!

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 Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants