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-16] [$500] Attachment - Red error message appears briefly when closing password protected PDF #28195

Closed
4 of 6 tasks
kbecciv opened this issue Sep 25, 2023 · 36 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

@kbecciv
Copy link

kbecciv commented Sep 25, 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:

Action Performed:

  1. Go any report
  2. Open password protected PDF page
  3. Click close button, Observe error message appears briefly

Expected Result:

No error message after close

Actual Result:

Error message appears briefly after closing password protected PDF

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native - did not provided yet, requested
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.74.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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-09-24.at.17.24.22.mov
Recording.4771.mp4

Expensify/Expensify Issue URL:
Issue reported by: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695551022734439

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b3fbc4b9a33f9413
  • Upwork Job ID: 1706411843181993984
  • Last Price Increase: 2023-10-02
  • Automatic offers:
    • jjcoffee | Reviewer | 26985177
    • namhihi237 | Contributor | 26985179
    • namhihi237 | Reporter | 26985182
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 25, 2023
@melvin-bot melvin-bot bot changed the title Attachment - Red error message appears briefly when closing password protected PDF [$500] Attachment - Red error message appears briefly when closing password protected PDF Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 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 Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

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

@kbecciv
Copy link
Author

kbecciv commented Sep 25, 2023

Proposal by: @namhihi237
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695551022734439

Proposal

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

Error message appears briefly after closing password-protected PDF, It also when we click download

What is the root cause of that problem?

We call the function check error when blur input:

onBlur={validateAndNotifyPasswordBlur}

In the function validateAndNotifyPasswordBlur we call validate function. That means when we click outside the input> it will tricker and show an error.
const validateAndNotifyPasswordBlur = () => {
validate();
onPasswordFieldFocused(false);
};

const validate = () => {
if (!isPasswordInvalid && !_.isEmpty(password)) {
return true;
}
if (_.isEmpty(password)) {
setValidationErrorText('attachmentView.passwordRequired');
}
return false;
};

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

I think we can remove validation when blur input. We only check when click confirm.

What alternative solutions did you explore? (Optional)

N/A

@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 26, 2023

Proposal

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

We have 2 bugs:

  1. Red error message appears briefly when closing password password-protected PDF
  2. Red error appear as soon as the app is put in background (ref: [HOLD for payment 2023-08-16] [$1000] Web - Task - Error is shown as soon as app is put in background when creating a task #23552)
Screen.Recording.2023-09-26.at.17.09.37.mov

What is the root cause of that problem?

const validateAndNotifyPasswordBlur = () => {
validate();
onPasswordFieldFocused(false);
};

This function will be triggered, even though user click on close button or put app in background

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

We should trigger the validate function on blur only when the current app is visible and has focus. And then we can use setTimeOut to delay validation like this

const validateAndNotifyPasswordBlur = () => {
        // Only run validation when user proactively blurs the input.
        if (!Visibility.isVisible() || !Visibility.hasFocus()) {
            return
        }
        setTimeout(() => {
            validate();
            onPasswordFieldFocused(false);
        }, 300);
    }

This is the way we did in Form Component and used in many places

setTimeout(() => {

result

Screen-Recording-2023-09-26-at-17.06.09.mp4

@melvin-bot melvin-bot bot added the Overdue label Sep 28, 2023
@jjcoffee
Copy link
Contributor

I'm leaning towards @namhihi237's proposal here as there isn't really any need to validate on blur in this case as we just have a single input (it also fixes the issue @DylanDylann mentions where the error shows when the app is put in the background).

The alternative would be to refactor PDFPasswordForm to use Form (suggested here), which would take advantage of the fix in #23552, but again I don't see that as super necessary since we really don't need to blur the input at all here.

🎀👀🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Sep 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 28, 2023

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

@michaelhaxhiu michaelhaxhiu removed their assignment Sep 28, 2023
@michaelhaxhiu
Copy link
Contributor

michaelhaxhiu commented Sep 28, 2023

I'm removing my assignment as BZ and leaving this with Nicole as part of my preparation for Sabbatical (starting Friday).

Next steps:

  • @aldo-expensify will review and approve @jjcoffee's assessment, at which point we should assign a contributor 🤞
  • Await completion of the PR
  • Pay the bug reporter / contributor / C+

@melvin-bot melvin-bot bot added the Overdue label Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

@NicMendonca, @jjcoffee, @aldo-expensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@aldo-expensify
Copy link
Contributor

@namhihi237 can you leave a message in this GH issue so I can assigned it to you 🙏

@melvin-bot melvin-bot bot removed the Overdue label Oct 2, 2023
@namhihi237
Copy link
Contributor

Thanks @aldo-expensify

@DylanDylann
Copy link
Contributor

@aldo-expensify i think the validation when blurring is a feature. Could we verify that before moving forward?

@aldo-expensify
Copy link
Contributor

@DylanDylann thanks for prompting me to check again. Looking at the problem again, this doesn't feel like a bug to me, it is just the validation validating correctly when the focus is lost from the input. I think we should just close this.

@aldo-expensify
Copy link
Contributor

aldo-expensify commented Oct 2, 2023

I'm going to ask for a second opinion on slack, but my vote for now is :donothing

cc @NicMendonca

@aldo-expensify
Copy link
Contributor

One more thing that I think we don't need to validate when blur is in case the user just wants to download, but when they click download they receive an error.

Good point

@aldo-expensify
Copy link
Contributor

Ok, lets continue with @namhihi237 proposal. It makes the code simpler and will work good enough. Introducing setTimeout is a pattern we want to avoid if possible, it will also need more work to fix this case and just doing it to be consistent with the Form case is not enough reason to go with it.

Thanks @DylanDylann for raising questions about considering other approaches and investigating, but I think we are at a good point to make the decision and stop spending more time on this.

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

📣 @jjcoffee 🎉 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

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

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

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

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

Offer link
Upwork job

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 5, 2023

🎯 ⚡️ Woah @jjcoffee / @namhihi237, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @namhihi237 got assigned: 2023-10-02 18:12:31 Z
  • when the PR got merged: 2023-10-05 04:44:18 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 9, 2023
@melvin-bot melvin-bot bot changed the title [$500] Attachment - Red error message appears briefly when closing password protected PDF [HOLD for payment 2023-10-16] [$500] Attachment - Red error message appears briefly when closing password protected PDF Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 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 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.79-5 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-16. 🎊

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 9, 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:

  • [@jjcoffee] The PR that introduced the bug has been identified. Link to the PR:
  • [@jjcoffee] 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:
  • [@jjcoffee] 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:
  • [@jjcoffee] Determine if we should create a regression test for this bug.
  • [@jjcoffee] 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.
  • [@NicMendonca] 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 Daily KSv2 labels Oct 16, 2023
@NicMendonca
Copy link
Contributor

@jjcoffee bump on the BZ check list ^

@NicMendonca
Copy link
Contributor

everyone has been paid 🎉 @jjcoffee @namhihi237

@jjcoffee
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: N/A - behaviour always existed
  • 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
  • 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: N/A
  • Determine if we should create a regression test for this bug. No - not really impactful enough
  • 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.

@NicMendonca
Copy link
Contributor

all set here then!

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