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-10-13] [$1000] mWeb - LHN - Click and long pressing a user report with lot of messages opens mark as unread popup inside report #25460

Closed
2 of 6 tasks
izarutskaya opened this issue Aug 18, 2023 · 86 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 Internal Requires API changes or must be handled by Expensify staff

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 18, 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. Open the app in android chrome
  2. Click on user report which has many messages in it
  3. Quickly long press to observe that it displays 'mark as unread' popup inside the report

Expected Result:

App should not display mark as unread popup inside report

Actual Result:

On opening user report with lots of messages and quickly long press, mark as unread popup gets opened inside the report

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: v1.3.55-4

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

mark.as.unread.popup.inside.the.report.mp4
Record_2023-08-18-10-06-56.mp4

Expensify/Expensify Issue URL:

Issue reported by: @dhanashree-sawant

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01404d8d81934e3635
  • Upwork Job ID: 1693977568321503232
  • Last Price Increase: 2023-08-22
  • Automatic offers:
    • Dhanashree-Sawant | Reporter | 26646326
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 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

@melvin-bot melvin-bot bot added the Overdue label Aug 21, 2023
@bfitzexpensify
Copy link
Contributor

OK, let's get some proposals for this one.

@melvin-bot melvin-bot bot removed the Overdue label Aug 22, 2023
@bfitzexpensify bfitzexpensify added the External Added to denote the issue can be worked on by a contributor label Aug 22, 2023
@melvin-bot melvin-bot bot changed the title mWeb - LHN - Click and long pressing a user report with lot of messages opens mark as unread popup inside report [$1000] mWeb - LHN - Click and long pressing a user report with lot of messages opens mark as unread popup inside report Aug 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

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

melvin-bot bot commented Aug 22, 2023

Triggered auto assignment to @muttmuure (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

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

@ishpaul777
Copy link
Contributor

ishpaul777 commented Aug 22, 2023

Proposal

Problem

when navigation is in progress if user long press the report mark as unread" popup opens inside report

What is the root cause of that problem?

The root cause is long press execution is not prevented if the navigation in progess resulting in opening of popover inside report.

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

Outdated

In PR we are introducing a new hook useSingleExecution we can use the same in OptionRowLHN

+ const {isExecuting, singleExecution} = useSingleExecution();
    
+ const showPopover = (event) => {
+         if (isExecuting) {
+            return;
+         }
<PressableWithSecondaryInteraction
      ref={popoverAnchor}
      onPress={(e) => {
            if (e) {
               e.preventDefault();
            }
+           singleExecution(() => props.onSelectRow(optionItem, popoverAnchor))();
-            props.onSelectRow(optionItem, popoverAnchor);
}}

2 alternative solutions proposed -
#25460 (comment)

@anukcr7
Copy link

anukcr7 commented Aug 22, 2023

Where should I send initial proposal?

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

📣 @anukcr7! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@redpanda-bit
Copy link
Contributor

redpanda-bit commented Aug 22, 2023

Proposal

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

Prevent long press action to take place if user navigated to another screen.

What is the root cause of that problem?

The code that shows the pop up is here:

const showPopover = (event) => {
setIsContextMenuActive(true);
ReportActionContextMenu.showContextMenu(
ContextMenuActions.CONTEXT_MENU_TYPES.REPORT,
event,
'',
popoverAnchor,
props.reportID,
{},
'',
() => {},
() => setIsContextMenuActive(false),
false,
false,
optionItem.isPinned,
optionItem.isUnread,
);
};

There is no debouce, throttle, or any sort of mutex lock in the function that prevents the pop up to be shown when the screen is already navigating away from LHN.

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

The event that occurs after a short press is a navigation to the Report page. Therefore we can use navigation to determine if the user has already short pressed the OptionRow, and if so prevent the pop up to appear despite the long press. This change would use useIsFocused hook from react-navigation or the withNavigationFocus HOC already in the codebase.

Here is the change if using useIsFocused:

On small screen devices, do not show popover if active route is the report screen .

// ...
import {Dimensions} from 'react-native'; // add this - using this instead of withDimensions prevents rerenders of list items when resizing screen
import Navigation from '../../libs/Navigation/Navigation'; // add this
import variables from '../../styles/variables'; // add this

function OptionRowLHN(props) {
    const popoverAnchor = useRef(null);
    const {translate} = useLocalize();
    
    const showPopover = (event) => {
        // add begin
        const isSmallScreenWidth = Dimensions.get('window').width <= variables.mobileResponsiveWidthBreakpoint;
        const isReportRoute = !!Navigation.getActiveRoute().match(CONST.REPORT_ROUTE_REGEX);
        if (isSmallScreenWidth && isReportRoute) {
            return;
        }
        // add end
        setIsContextMenuActive(true);
        ReportActionContextMenu.showContextMenu(
            ContextMenuActions.CONTEXT_MENU_TYPES.REPORT,
// ...

A slightly more complex change if the withNavigationFocus HOC is used, including a prop rename since the OptionRowLHN already makes use of an isFocused prop which is different from the usage in this proposal.

### However, I would like to know if the changes I am proposing would cause the entire list to be re-rendered when navigating since useIsFocused() is updated when navigation occurs.

What alternative solutions did you explore? (Optional)

  1. Dismissing the pop up in the next screen, this is undesirable given that it may result in a flicker.
  2. Using a flag in OptioRowLHN timed for the duration of the navigation to prevent further user interactions.

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@Anmolverma19
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: (https://www.upwork.com/freelancers/anmolv3)

@melvin-bot
Copy link

melvin-bot bot commented Aug 22, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@Anmolverma19
Copy link

I have submitted the proposal on Upwork already

@redpanda-bit
Copy link
Contributor

@anukcr7 and @Anmolverma19 information on how to submit proposals is in this document contributing guidelines.

@Anmolverma19
Copy link

Proposal

Please re-state the problem that we are trying to solve in this issue.
Prevent long press action to take place if user navigated to another screen.

What is the root cause of that problem?
According to me, Root cause lies in how touch and gesture events are handled and how UI/UX elements are hovered or triggered on certain user movement or usage

What changes do you think we should make in order to solve the problem?
Here's what I initially plan to do to resolve it:
To fix the issue where the "Mark as Unread" option appears when a user performs a long press on the left side of the screen while inside a report, I will need to make changes to the React Native codebase. Below are the steps to address this problem:
Step 1: Locate the Code Responsible for the Long Press Gesture

  1. Open the Expensify/App GitHub repository.
  2. Navigate to the specific file or component that handles the long press gesture within a report. This can often be found in the component responsible for rendering reports or in a separate gesture handler component.

Step 2: Identify the Event Handling Logic

  1. Inspect the code to find the event handling logic for the long press gesture on the left side of the screen. Look for code related to touch or gesture recognition that triggers the "Mark as Unread" option.

Step 3: Modify or Remove the Event Handling Logic

  1. Once located the event handling logic, one can either modify it to prevent the "Mark as Unread" option from appearing or remove it entirely, depending on project's requirements.
  • To modify: If there is a condition that checks for the long press event and then displays the "Mark as Unread" option, I can update this condition to prevent the option from appearing when a long press occurs on the left side of the screen.
  • To remove: If the event handling code is unnecessary for the left side of the screen long press, I can delete or comment out the relevant code block.

Step 4: Test Extensively

  1. After making changes, thoroughly test the application on all relevant platforms to ensure that the "Mark as Unread" option no longer appears when doing a long press on the left side of the screen within a report.

Step 5: Document Changes

  1. It's essential to document the changes I will make to the codebase. Update comments or documentation within the code to explain the purpose of my modifications. This documentation will help other developers understand changes in the future.

Step 6: Create a Pull Request

  1. Once confident that code changes have resolved the issue, create a pull request in the Expensify/App GitHub repository to merge the changes into the main codebase. Include a clear description of the problem and my solution in the pull request.

What alternative solutions did you explore? (Optional)
Step 1: Identify the UI Element

  1. Inspect the user interface (UI) of the report screen in the application to locate the “Mark as Unread” option or the element that triggers it.

Step 2: Apply CSS or Styling Changes

  1. one can use CSS or styling changes to hide the “Mark as Unread” option when certain conditions are met. Specifically, want to target this option when it appears as a result of a long press on the left side of the screen.
  2. Use CSS to hide the element or set its visibility to “hidden” or “display: none;” within the report screen’s styling.
  3. To target the left side of the screen specifically, may need to apply CSS based on the screen’s layout or structure. For instance, could use CSS classes, element IDs, or parent-child relationships to identify the left side of the screen.

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@redpanda-bit

This comment was marked as resolved.

@redpanda-bit
Copy link
Contributor

redpanda-bit commented Aug 23, 2023

Here is how it looks with my proposed solution.

pop-up-lhn.mov

@ishpaul777
Copy link
Contributor

@carlosalmonte04 Only raise a PR once your proposal is selected by C+ reviewer.

@ishpaul777
Copy link
Contributor

ishpaul777 commented Aug 24, 2023

we are implementing useSingleExecution hook in this PR - #24173, we can use the same in this case once PR is merged

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Oct 6, 2023
@melvin-bot melvin-bot bot changed the title [$1000] mWeb - LHN - Click and long pressing a user report with lot of messages opens mark as unread popup inside report [HOLD for payment 2023-10-13] [$1000] mWeb - LHN - Click and long pressing a user report with lot of messages opens mark as unread popup inside report Oct 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.78-4 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-10-13. 🎊

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

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

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 Oct 6, 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:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:
  • [@sobitneupane] 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:
  • [@sobitneupane] 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:
  • [@sobitneupane] Determine if we should create a regression test for this bug.
  • [@sobitneupane] 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.
  • [@bfitzexpensify / @muttmuure] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 12, 2023
@bfitzexpensify
Copy link
Contributor

Payment summary:

Reporter: @dhanashree-sawant $250 to be paid via Upwork - offer sent
Contributor: @redpanda-bit $1000 to be paid via Upwork - please apply here - https://www.upwork.com/jobs/~0131d1e4274cbc8262
C+: @sobitneupane to be paid $1000 via manual request

@redpanda-bit
Copy link
Contributor

@bfitzexpensify applied thanks.

@dhanashree-sawant
Copy link

Hi @bfitzexpensify, melvin bot already had sent offer for this job 1 month back and I have also accepted this without cross checking so now I have 2 offers for this job. I have one more job which is ready for payment and I don't have offer in it and it was raised 29 August so would be compensated 250$ for it.
Link to the job: #26131
To solve this 2 offer issue, can we communicate with @kevinksullivan once and pay that jobs reporting bonus in one of the 2 offers?

Summary would be that @kevinksullivan won't have to send me offer in that job and we can approve both the offers for this job.

@melvin-bot melvin-bot bot added the Overdue label Oct 16, 2023
@Gonals
Copy link
Contributor

Gonals commented Oct 17, 2023

not overdue

@melvin-bot melvin-bot bot removed the Overdue label Oct 17, 2023
@bfitzexpensify
Copy link
Contributor

@dhanashree-sawant it's better for our audit trails to link payments to the correct job rather than double-paying against a single job, so we'll keep the usual process in place and have you get paid via #26131.

Also a friendly reminder @sobitneupane to complete the BZ checklist when you get a moment - thanks!

@muttmuure muttmuure removed their assignment Oct 20, 2023
@melvin-bot melvin-bot bot added the Overdue label Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

@Gonals, @redpanda-bit, @sobitneupane, @bfitzexpensify Huh... This is 4 days overdue. Who can take care of this?

@bfitzexpensify
Copy link
Contributor

Bump on the BZ checklist @sobitneupane - thank you!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 24, 2023
@sobitneupane
Copy link
Contributor

Sorry for the delay. I was OOO. I will try to get to this issue in the weekend.

@melvin-bot melvin-bot bot removed the Overdue label Oct 27, 2023
@sobitneupane
Copy link
Contributor

sobitneupane commented Oct 30, 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:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:

I believe it was present from the very beginning with the introduction of the feature.

  • [@sobitneupane] 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:

N/A

  • [@sobitneupane] 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:

It is an edge case and very difficult to catch.

  • [@sobitneupane] Determine if we should create a regression test for this bug.

Yes.

  • [@sobitneupane] 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.

#25460 (comment)

@sobitneupane
Copy link
Contributor

Regression Test Proposal:

  • Long Press (on IOS, Android and mWeb) an option row from LHN.
  • Verify pop up shows
  • Dismiss the pop up by tapping outside
  • Tap on one of the items and quickly long press on the same item
  • Verify pop up does not show while on the report screen

Do we agree 👍 or 👎

@sobitneupane
Copy link
Contributor

Requested payment on newDot.

#25460 (comment)

@bfitzexpensify
Copy link
Contributor

Cool, I agree with that checklist summary. Opened regression test proposal in https://github.com/Expensify/Expensify/issues/331848. We're all done here - thanks everyone!

@JmillsExpensify
Copy link

$1,000 payment approved for @sobitneupane based on this comment.

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 Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests