Skip to content

[HOLD for payment 2023-07-26] [$1000] Chat - Inconsistent behavior on deleting message that have reply/thread #21103

Closed

Description

@kbecciv

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. 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

Activity

  1. added
    Daily
    Bug
    on Jun 20, 2023
  2. melvin-bot commented on Jun 20, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jun 20, 2023

    @melvin-bot

    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
  4. hungvu193 commented on Jun 20, 2023

    @hungvu193
    Contributor

    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);
    }
  5. joekaufmanexpensify commented on Jun 20, 2023

    @joekaufmanexpensify
    Contributor

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

  6. joekaufmanexpensify commented on Jun 21, 2023

    @joekaufmanexpensify
    Contributor

    Still determining next steps

  7. joekaufmanexpensify commented on Jun 22, 2023

    @joekaufmanexpensify
    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
  8. added
    External
    on Jun 22, 2023
  9. changed the title [-]Chat - Inconsistent behavior on deleting message that have reply/thread[/-] [+][$1000] Chat - Inconsistent behavior on deleting message that have reply/thread[/+] on Jun 22, 2023
  10. melvin-bot commented on Jun 22, 2023

    @melvin-bot
  11. added
    Help Wanted
    on Jun 22, 2023
  12. melvin-bot commented on Jun 22, 2023

    @melvin-bot

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

  13. melvin-bot commented on Jun 22, 2023

    @melvin-bot

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

  14. 75 remaining items

  15. joekaufmanexpensify commented on Jul 24, 2023

    @joekaufmanexpensify
    Contributor

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

  16. fedirjh commented on Jul 25, 2023

    @fedirjh
    Contributor

    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
  17. added
    Daily
    and removed
    Weekly
    on Jul 25, 2023
  18. joekaufmanexpensify commented on Jul 26, 2023

    @joekaufmanexpensify
    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:

  19. joekaufmanexpensify commented on Jul 26, 2023

    @joekaufmanexpensify
    Contributor

    @hungvu193 $1,500 sent and contract ended!

  20. hungvu193 commented on Jul 26, 2023

    @hungvu193
    Contributor

    @hungvu193 $1,500 sent and contract ended!

    Thank you! 😄

  21. joekaufmanexpensify commented on Jul 26, 2023

    @joekaufmanexpensify
    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!

  22. joekaufmanexpensify commented on Jul 26, 2023

    @joekaufmanexpensify
    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!

  23. joekaufmanexpensify commented on Jul 26, 2023

    @joekaufmanexpensify
    Contributor

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

  24. fedirjh commented on Jul 26, 2023

    @fedirjh
    Contributor

    @joekaufmanexpensify Thank you. Accepted

  25. joekaufmanexpensify commented on Jul 26, 2023

    @joekaufmanexpensify
    Contributor

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

  26. joekaufmanexpensify commented on Jul 26, 2023

    @joekaufmanexpensify
    Contributor

    Upwork job closed.

  27. joekaufmanexpensify commented on Jul 26, 2023

    @joekaufmanexpensify
    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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyEngineeringExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions