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 2024-04-15] [$500] Self - DM - App returns to previous conversation instead of self-DM after leaving self-DM thread #38689

Closed
6 tasks done
lanitochka17 opened this issue Mar 20, 2024 · 39 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 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Mar 20, 2024

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.55-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/S
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to 1:1 DM
  3. Send a message, reply in thread and leave thread
  4. Note that user is redirected to 1:1 DM in Step 2
  5. Click the Search icon in the LGN > type 'you' > start a self DM
  6. Send a message, reply in thread and leave thread

Expected Result:

After leaving thread, app will return to self-DM

Actual Result:

After leaving thread, app returns to a previous conversation before self-DM

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6420704_1710951422604.20240321_001108.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016b6d3e4e9cf9c054
  • Upwork Job ID: 1770633111502032896
  • Last Price Increase: 2024-03-21
  • Automatic offers:
    • abzokhattab | Contributor | 0
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 20, 2024
Copy link

melvin-bot bot commented Mar 20, 2024

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

@lanitochka17
Copy link
Author

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

@lanitochka17
Copy link
Author

@Christinadobrzyn FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@abzokhattab
Copy link
Contributor

abzokhattab commented Mar 20, 2024

Proposal

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

App returns to previous conversation instead of self-DM after leaving self-DM thread

What is the root cause of that problem?

we dont consider the self dm when calculating the lastAccessedReportID here which was added in this PR:

App/src/libs/actions/Report.ts

Lines 2363 to 2379 in 26ab4aa

// We want to filter out the current report, hidden reports and empty chats
const filteredReportsByLastRead = sortedReportsByLastRead.filter(
(sortedReport) =>
sortedReport?.reportID !== reportID &&
sortedReport?.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN &&
ReportUtils.shouldReportBeInOptionList({
report: sortedReport,
currentReportId: '',
isInGSDMode: false,
betas: [],
policies: {},
excludeEmptyChats: true,
doesReportHaveViolations: false,
}),
);
const lastAccessedReportID = filteredReportsByLastRead.at(-1)?.reportID;

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

we need to add includeSelfDM: true, to the shouldReportBeInOptionList function input above

POC

Screen.Recording.2024-03-20.at.7.23.21.PM.mov

@nkdengineer
Copy link
Contributor

nkdengineer commented Mar 20, 2024

Proposal

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

  • Self - DM - App returns to previous conversation instead of self-DM after leaving self-DM thread

What is the root cause of that problem?

  • In here, we allow user to leave in case of selfDM 's thread.
  • And when leaving room, we do not include the selfDM in here, that leads to the bug.

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

  • We should not allow user to leave the selftDM 's thread because the self-DM is the spot for private notes. We can do it by update this to:
    const outerMostReportID = last(getAllAncestorReportActionIDs(report).reportIDs)
    const isSelfDMThread = ReportUtils.isSelfDM(getReport(outerMostReportID))
    const canJoinOrLeave = !isSelfDMThread && !isSelfDM && (isChatThread || isUserCreatedPolicyRoom || canLeaveRoom);

What alternative solutions did you explore? (Optional)

  • Additonally, because the self-DM is the spot for private notes, so we should not display the selfDM 's threads in LHN. We can do it by adding the below logic to this one:
    const outerMostReportID = last(getAllAncestorReportActionIDs(report).reportIDs);
    const isSelfDMThread = isSelfDM(getReport(outerMostReportID));
    if (isSelfDMThread) {
        return false;
    }

@allgandalf
Copy link
Contributor

Proposal

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

App returns to previous conversation instead of self-DM after leaving self-DM thread

What is the root cause of that problem?

We have not set includeSelfDM to true in shouldReportBeInOptionList:

App/src/libs/actions/Report.ts

Lines 2348 to 2357 in 399077f

ReportUtils.shouldReportBeInOptionList({
report: sortedReport,
currentReportId: '',
isInGSDMode: false,
betas: [],
policies: {},
excludeEmptyChats: true,
doesReportHaveViolations: false,
}),
);

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

When saw other pages which use shouldReportBeInOptionList we pass the value of includeSelfDM as true everywhere.

return ReportUtils.shouldReportBeInOptionList({
report,
currentReportId: currentReportId ?? '',
isInGSDMode,
betas,
policies,
excludeEmptyChats: true,
doesReportHaveViolations,
includeSelfDM: true,

return ReportUtils.shouldReportBeInOptionList({
report,
currentReportId: Navigation.getTopmostReportId() ?? '',
betas,
policies,
doesReportHaveViolations,
isInGSDMode: false,
excludeEmptyChats: false,
includeSelfDM,

return ReportUtils.shouldReportBeInOptionList({
report,
currentReportId: Navigation.getTopmostReportId() ?? '',
betas,
policies,
doesReportHaveViolations,
isInGSDMode: false,
excludeEmptyChats: false,
includeSelfDM,

So to avoid redundancy of code i propose that we update the shouldReportBeInOptionList function itself to set the default value of includeSelfDM to true, currently it is set to false:

App/src/libs/ReportUtils.ts

Lines 4176 to 4185 in 399077f

function shouldReportBeInOptionList({
report,
currentReportId,
isInGSDMode,
betas,
policies,
excludeEmptyChats,
doesReportHaveViolations,
includeSelfDM = false,
}: {

Then we remove the redundant part of the code in every component

What alternative solutions did you explore? (Optional)

N/A

@Christinadobrzyn
Copy link
Contributor

I can recreate this based on the steps in the OP - I think this can be external and part of vip-vsb

@Christinadobrzyn Christinadobrzyn added the External Added to denote the issue can be worked on by a contributor label Mar 21, 2024
@melvin-bot melvin-bot bot changed the title Self - DM - App returns to previous conversation instead of self-DM after leaving self-DM thread [$500] Self - DM - App returns to previous conversation instead of self-DM after leaving self-DM thread Mar 21, 2024
Copy link

melvin-bot bot commented Mar 21, 2024

Job added to Upwork: https://www.upwork.com/jobs/~016b6d3e4e9cf9c054

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 21, 2024
Copy link

melvin-bot bot commented Mar 21, 2024

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

@Christinadobrzyn
Copy link
Contributor

we have some proposals to review when you have a chance @Santhosh-Sellavel!

@shubham1206agra
Copy link
Contributor

@ishpaul777 Can you help here as you were the author of self DM?

@melvin-bot melvin-bot bot added the Overdue label Mar 25, 2024
@Santhosh-Sellavel
Copy link
Collaborator

@abzokhattab's proposal looks good and straight-forward!

C+ Reviewed
🎀 👀 🎀

Copy link

melvin-bot bot commented Mar 25, 2024

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

@nkdengineer
Copy link
Contributor

nkdengineer commented Mar 25, 2024

@luacmartins @Santhosh-Sellavel Should we hide the "Leave" option in case of selfDM? May be it is related to this comment

@Santhosh-Sellavel
Copy link
Collaborator

Should we hide the "Leave" option in case of selfDM?

Yes for self-dm we should hide leave, not for self-dm thread

@nkdengineer
Copy link
Contributor

nkdengineer commented Mar 25, 2024

Yeah, I mean that selfDM 's threads. Because, self-DM is the spot for private notes, only current users can access it, and its thread as well. So I think the "leave" or "join" options in self-DM are redundant

@Santhosh-Sellavel
Copy link
Collaborator

We can invite any users to specific threads. So Leave or Join makes sense to me, I'll let the team decide on it

cc: @luacmartins

@luacmartins
Copy link
Contributor

luacmartins commented Mar 25, 2024

Yea, agreed that we should hide those buttons for selfDM threads too. @Santhosh-Sellavel do you need to revise the approved proposal based on this?

@shubham1206agra
Copy link
Contributor

@luacmartins I thought we could invite anyone on the thread related to self-DM but not self-DM itself.

Tagging @thienlnam here.

@luacmartins
Copy link
Contributor

@abzokhattab what's the ETA for the PR?

@melvin-bot melvin-bot bot removed the Overdue label Apr 1, 2024
@abzokhattab
Copy link
Contributor

will be ready today thanks @luacmartins for the ping.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Apr 3, 2024
@abzokhattab
Copy link
Contributor

The PR is ready. please have a look and let me know if you have any comments.

@Christinadobrzyn
Copy link
Contributor

PR is under 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 Apr 8, 2024
@melvin-bot melvin-bot bot changed the title [$500] Self - DM - App returns to previous conversation instead of self-DM after leaving self-DM thread [HOLD for payment 2024-04-15] [$500] Self - DM - App returns to previous conversation instead of self-DM after leaving self-DM thread Apr 8, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 8, 2024
Copy link

melvin-bot bot commented Apr 8, 2024

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

Copy link

melvin-bot bot commented Apr 8, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.60-13 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 2024-04-15. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Apr 8, 2024

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:

  • [@Santhosh-Sellavel] The PR that introduced the bug has been identified. Link to the PR:
  • [@Santhosh-Sellavel] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@Santhosh-Sellavel] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@Santhosh-Sellavel] Determine if we should create a regression test for this bug.
  • [@Santhosh-Sellavel] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@Christinadobrzyn
Copy link
Contributor

Christinadobrzyn commented Apr 11, 2024

Payouts due:

Upwork job is here.

@Santhosh-Sellavel do we need a regression test for this?

@Santhosh-Sellavel
Copy link
Collaborator

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:

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 17, 2024
@Christinadobrzyn
Copy link
Contributor

awesome! no regression test is needed. Closing this. Let me know if I missed anything.

Payment summary here for @Santhosh-Sellavel payment through NewDot.

@Santhosh-Sellavel
Copy link
Collaborator

Requested on ND

@JmillsExpensify
Copy link

$500 approved for @Santhosh-Sellavel

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 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

10 participants