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-12-03] [$250] Threads - Reply in threads option shown for parent message in thread #50262

Closed
1 of 6 tasks
lanitochka17 opened this issue Oct 4, 2024 · 38 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 Oct 4, 2024

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


Version Number: 9.0.44-6
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/A
Email or phone of affected tester (no customers): Negasofonias@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to any chat and open a thread or create one
  2. open the thread and right click on the parent message and observe that reply in a thread option is available
  3. Click on it and observe it just focuses the composer box

Expected Result:

Reply in a thread option should not be shown for the parent message

Actual Result:

Reply in a thread option is available with out any purpose

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
Bug6617626_1727458359699.scrnli_9_27_2024_8-23-11_PM.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021843831874684578762
  • Upwork Job ID: 1843831874684578762
  • Last Price Increase: 2024-10-23
  • Automatic offers:
    • allgandalf | Reviewer | 104652631
Issue OwnerCurrent Issue Owner: @anmurali
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 4, 2024
Copy link

melvin-bot bot commented Oct 4, 2024

Triggered auto assignment to @anmurali (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

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

@Nodebrute
Copy link
Contributor

Nodebrute commented Oct 4, 2024

Edited by proposal-police: This proposal was edited at 2024-10-04 19:38:57 UTC.

Proposal

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

Reply in threads option shown for parent message in thread

What is the root cause of that problem?

We use this check to show Reply In thread.

return !ReportUtils.shouldDisableThread(reportAction, reportID);

It was working fine until we added ancestor.report.

This function checks if it's the thread's first chat. However, the ancestor.report we're using now passes the parent report's reportID instead of the current report's. As a result, this check will return false.

App/src/libs/ReportUtils.ts

Lines 1559 to 1561 in 8f35228

function isThreadFirstChat(reportAction: OnyxInputOrEntry<ReportAction>, reportID: string): boolean {
return reportAction?.childReportID?.toString() === reportID;
}

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

We should pass the correct reportID to isThreadFirstChat. In BaseReportActionContextMenu we can use useCurrentReportID() to get the reportID and then we can pass that reportID here

}: BaseReportActionContextMenuProps) {

And then we can pass currentReportIDValue?.currentReportID to this function instead of reportID

return !ReportUtils.shouldDisableThread(reportAction, reportID);

Optional: We can pass currentReportIDValue?.currentReportID as third parameter in shouldDisableThread and only use it to pass it to isThreadFirstChat.

We can check for other places too where we need to pass the correct Id.

What alternative solutions did you explore? (Optional)

We can create a function in ContextMenuActions.tsx to get current report Id.

pseudoCode

function getCurrentReportID(){
    const currentReportIDValue = useCurrentReportID();
    return currentReportIDValue?.currentReportID ?? ''
}

and then in here we can get the currentReportId value

      const currentReportId = getCurrentReportID()

and then we can pass it to isThreadFirstChat

Optional: We can pass currentReportID as third parameter in shouldDisableThread and only use it to pass it to isThreadFirstChat.

@bernhardoj
Copy link
Contributor

Proposal

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

Reply in thread option appears for thread first chat.

What is the root cause of that problem?

We check whether the user can reply in thread, but only if it's not a thread first chat.

isThreadFirstChat(reportAction, reportID)

isThreadFirstChat compares the action childReportID with the passed reportID.

App/src/libs/ReportUtils.ts

Lines 1559 to 1561 in 99f280b

function isThreadFirstChat(reportAction: OnyxInputOrEntry<ReportAction>, reportID: string): boolean {
return reportAction?.childReportID?.toString() === reportID;
}

The reportID is coming from ReportActionItem. However, after this PR, the reportID contains the reportID of the report where the action belongs to.

For example, if we create a thread from report A, the reportID will be report A instead of B. So, isThreadFirstChat will always be false.

This also causes the Join Thread to shows up for thread first chat.

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

Instead of using isThreadFirstChat() function which requires a reportID that can be anything, we can have a new prop for ReportActionItem also called isThreadFirstChat. It will only be true if the ReportActionItem is coming from ReportActionItemParentAction.

<ReportActionItem
onPress={
ReportUtils.canCurrentUserOpenReport(ancestorReports.current?.[ancestor?.report?.reportID ?? '-1'])

Then, pass the prop down to BaseReportActionContextMenu. BaseReportActionContextMenu will use it for the shouldShow function.

contextAction.shouldShow(
type,
reportAction,
isArchivedRoom,
betas,
anchor,
isChronosReport,
reportID,
isPinnedChat,
isUnreadChat,
!!isOffline,
isMini,
isProduction,
moneyRequestAction,
areHoldRequirementsMet,
),

Then, we pass it to shouldDisableThread.

shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget, isChronosReport, reportID) => {
if (type !== CONST.CONTEXT_MENU_TYPES.REPORT_ACTION) {
return false;
}
return !ReportUtils.shouldDisableThread(reportAction, reportID);
},

And replace the function here with the new isThreadFirstChat param

isThreadFirstChat(reportAction, reportID)

We will replace all isThreadFirstChat() usage with the new prop.

@melvin-bot melvin-bot bot added the Overdue label Oct 7, 2024
Copy link

melvin-bot bot commented Oct 7, 2024

@anmurali Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Oct 8, 2024

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

@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Oct 9, 2024
@melvin-bot melvin-bot bot changed the title Threads - Reply in threads option shown for parent message in thread [$250] Threads - Reply in threads option shown for parent message in thread Oct 9, 2024
Copy link

melvin-bot bot commented Oct 9, 2024

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

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

melvin-bot bot commented Oct 9, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Oct 9, 2024
Copy link

melvin-bot bot commented Oct 14, 2024

@anmurali, @allgandalf Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Oct 14, 2024
@allgandalf
Copy link
Contributor

Not overdue sir melvin! 🙇

@melvin-bot melvin-bot bot removed the Overdue label Oct 14, 2024
Copy link

melvin-bot bot commented Oct 16, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Oct 18, 2024

@anmurali @allgandalf this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Oct 18, 2024
Copy link

melvin-bot bot commented Oct 18, 2024

@anmurali, @allgandalf Whoops! This issue is 2 days overdue. Let's get this updated quick!

@Nodebrute
Copy link
Contributor

@allgandalf bump for review

@allgandalf
Copy link
Contributor

I didn't realise there were proposals here, I will review today 👍

@melvin-bot melvin-bot bot removed the Overdue label Oct 21, 2024
@allgandalf
Copy link
Contributor

allgandalf commented Oct 22, 2024

@bernhardoj 's solution looks good to me. This way we make sure that we only show the reply in thread option if the ReportActionItem is coming from ReportActionItemParentAction.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Oct 29, 2024

📣 @allgandalf 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@bernhardoj
Copy link
Contributor

PR is ready

cc: @allgandalf

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 30, 2024
@allgandalf
Copy link
Contributor

PR is on staging

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 26, 2024
@melvin-bot melvin-bot bot changed the title [$250] Threads - Reply in threads option shown for parent message in thread [HOLD for payment 2024-12-03] [$250] Threads - Reply in threads option shown for parent message in thread Nov 26, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 26, 2024
Copy link

melvin-bot bot commented Nov 26, 2024

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

Copy link

melvin-bot bot commented Nov 26, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.66-8 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-12-03. 🎊

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

Copy link

melvin-bot bot commented Nov 26, 2024

@allgandalf @anmurali @allgandalf The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@allgandalf
Copy link
Contributor

allgandalf commented Nov 28, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production
  • 2b. Reported on staging (deploy blocker)
  • 2c. Reported on both staging and production
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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: https://github.com/Expensify/App/pull/43518/files#r1861560822

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Precondition:

  • None

Test:

  1. Send a message to any chat
  2. Right-click/long-press and choose reply in thread
  3. Right-click/long-press the thread parent message

Verify there is no Reply in thread option

  1. (Web/Desktop) Hover over the message and press the 3-dot button

Verify there is no Reply in thread option

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Dec 3, 2024
@allgandalf
Copy link
Contributor

@anmurali can you pay this one please

@bernhardoj
Copy link
Contributor

Requested in ND.

@melvin-bot melvin-bot bot added the Overdue label Dec 5, 2024
@allgandalf
Copy link
Contributor

not overdue, pending payment

Copy link

melvin-bot bot commented Dec 6, 2024

@anmurali, @neil-marcellini, @bernhardoj, @allgandalf Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@JmillsExpensify
Copy link

Waiting on payment summary

Copy link

melvin-bot bot commented Dec 10, 2024

@anmurali, @neil-marcellini, @bernhardoj, @allgandalf 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@anmurali
Copy link

anmurali commented Dec 10, 2024

Payment Summary

@melvin-bot melvin-bot bot removed the Overdue label Dec 10, 2024
@JmillsExpensify
Copy link

$250 approved for @bernhardoj

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
None yet
Development

No branches or pull requests

7 participants