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

[$250] Approve - "Waiting for you to pay" message appears briefly for approver after approving report #41081

Closed
6 tasks done
izarutskaya opened this issue Apr 26, 2024 · 37 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@izarutskaya
Copy link

izarutskaya commented Apr 26, 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: 1.4.66-2
Reproducible in staging?: Y
Reproducible in production?: Y
Found when validating PR: #40532
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

Precondition:

  • Collect workspace has another user as approver.
  1. Go to staging.new.expensify.com
  2. [Admin] Go to workspace chat.
  3. [Admin] Create an expense and submit the report.
  4. [Approver] Go to transaction thread.
  5. [Approver] Click Approve button.

Expected Result:

Approver will not be presented with this Next step message "Waiting for you to pay these expenses".

Actual Result:

"Waiting for you to pay these expenses" message appears briefly for approver after approving the report.

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

Bug6462601_1714121004492.bandicam_2024-04-26_16-36-46-329.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~013e61cf7fb38074ac
  • Upwork Job ID: 1785010427319132160
  • Last Price Increase: 2024-05-14
  • Automatic offers:
    • eh2077 | Reviewer | 0
    • GandalfGwaihir | Contributor | 0
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 26, 2024
Copy link

melvin-bot bot commented Apr 26, 2024

Triggered auto assignment to @muttmuure (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.

@izarutskaya
Copy link
Author

We think this issue might be related to the #collect project.

@allgandalf
Copy link
Contributor

Proposal

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

Wrong optimistic message is seen for the approver who is not the owner of the policy

What is the root cause of that problem?

Currently in NextStepsUtils, we do not cover the case where the approver is not the owner of the policy, this causes the current regression, as first we will show the optimistic message which will be set to waiting for you to pay...:

if (!isOwner) {
optimisticNextStep.message = [
{
text: 'Waiting for ',
},
{
text: managerDisplayName,

here the managerDisplayName would be set to you as :

const managerDisplayName = isSelfApproval ? 'you' : ReportUtils.getDisplayNameForParticipant(submitToAccountID) ?? '';

isSelfApproval will be true as the current account id would be equal to the approver/submitter account id:

const isSelfApproval = currentUserAccountID === submitToAccountID;

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

We need to add new code which will check if the current user is the approver of the policy but isn't the owner of the policy, and then we will set the optimistic message for this case which will match with the BE returned value:

case CONST.REPORT.STATUS_NUM.APPROVED:
            if (isManager && !isOwner) {
                optimisticNextStep = {
                    type,
                    title: 'Finished!',
                    message: [
                        {
                            text: 'No further action required!',
                        },
                    ],
                };
            } else {
            ..... (The current existing code)

Note: instead of isManager to be more careful we can check submitToAccountID === currentUserAccountID, but that can be discussed during PR stage

Results

Screen.Recording.2024-04-27.at.4.16.23.AM.mov

@melvin-bot melvin-bot bot added the Overdue label Apr 29, 2024
@muttmuure muttmuure added the External Added to denote the issue can be worked on by a contributor label Apr 29, 2024
@melvin-bot melvin-bot bot changed the title Approve - "Waiting for you to pay" message appears briefly for approver after approving report [$250] Approve - "Waiting for you to pay" message appears briefly for approver after approving report Apr 29, 2024
Copy link

melvin-bot bot commented Apr 29, 2024

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

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

melvin-bot bot commented Apr 29, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Apr 29, 2024
Copy link

melvin-bot bot commented Apr 29, 2024

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

@eh2077
Copy link
Contributor

eh2077 commented Apr 30, 2024

Commented in the related PR to confirm if this is a legit regression

@allgandalf
Copy link
Contributor

I guess we're good to proceed with the current issue based on this comment #40532 (comment) @eh2077

@eh2077
Copy link
Contributor

eh2077 commented Apr 30, 2024

reviewing proposals

@eh2077
Copy link
Contributor

eh2077 commented May 1, 2024

When owner and approver are the same person, the behaviour is same as described in this issue (owner and approver are different) after clicking the Approve button - Show Waiting for you to pay these expenses. and then No further action required!

0-admin-and-approver-are-same.mp4

@muttmuure Can you help to clarity the expected behaviours here?

  • Case 1: If the owner and approver are different, what should be the next message?
  • Case 2: if the owner and approver are same person, what should be the next message?

Note: currently both cases show Waiting for you to pay these expenses. briefly and then show No further action required!

@muttmuure
Copy link
Contributor

Will chat with Tom

@muttmuure
Copy link
Contributor

The owner isn't a factor here, the owner is the person who owns billing

@muttmuure
Copy link
Contributor

@eh2077
Copy link
Contributor

eh2077 commented May 1, 2024

@muttmuure So in both cases the next step message will be No further action required! right?

@muttmuure
Copy link
Contributor

Make or track payments is enabled, so there should be an action to pay, it just depends who it is - I will revert back soon

@eh2077
Copy link
Contributor

eh2077 commented May 3, 2024

Make or track payments is enabled, so there should be an action to pay, it just depends who it is - I will revert back soon

@muttmuure Sorry, the expected results are still not clear to me. Looking forward to your update, thanks.

@eh2077
Copy link
Contributor

eh2077 commented May 6, 2024

Waiting for update from @muttmuure

Copy link

melvin-bot bot commented May 7, 2024

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

@muttmuure
Copy link
Contributor

If Make and track payments is enabled but no bank account is connected, the message Waiting for you to pay these expenses should be showing for all admins.

So the unexpected behavior here is that No further action required is showing at all. It should be Waiting for you to pay these expenses

@eh2077
Copy link
Contributor

eh2077 commented May 7, 2024

@muttmuure Thank you for making that clear.

@GandalfGwaihir Can you update your proposal based on @muttmuure 's comment ^?

@melvin-bot melvin-bot bot added the Overdue label May 9, 2024
@eh2077
Copy link
Contributor

eh2077 commented May 10, 2024

@GandalfGwaihir Friendly bump!

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

melvin-bot bot commented May 10, 2024

@muttmuure @eh2077 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!

@allgandalf
Copy link
Contributor

allgandalf commented May 10, 2024

So the unexpected behavior here is that No further action required is showing at all. It should be Waiting for you to pay these expenses

I think you understood the issue wrong here @muttmuure , it indeed shows Waiting for you to pay these expenses for all admins.

The bug here is for approver (The person who is an approver but not the admin/owner of the workspace). In this case we optimistically set the message to Waiting for you to pay these expenses and then the BE returns no actions needed (which is right as the approver doesn't have the authority to pay the expense as he is neither the admin nor owner).

So I guess my proposal still is valid for the bug described in the OP.

What are your thoughts @muttmuure @eh2077 , sorry for the delay in reply

@melvin-bot melvin-bot bot added the Overdue label May 13, 2024
@eh2077
Copy link
Contributor

eh2077 commented May 13, 2024

The bug here is for approver (The person who is an approver but not the admin/owner of the workspace). In this case we optimistically set the message to Waiting for you to pay these expenses and then the BE returns no actions needed (which is right as the approver doesn't have the authority to pay the expense as he is neither the admin nor owner).

This makes sense to me if we only want to fix this specific use case.

But I think it'll be better to fix #41081 (comment) together as they're relevant.

@GandalfGwaihir What do you think?

cc @muttmuure

@melvin-bot melvin-bot bot removed the Overdue label May 13, 2024
Copy link

melvin-bot bot commented May 14, 2024

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

@allgandalf
Copy link
Contributor

@GandalfGwaihir What do you think?

I am Okay with that, but for this to happen we also need a BE fix right, cause the message No further action required is set fro the BE, we can make the FE changes to set the message optimistically, but BE should also be async, but I think the discussion we had is sufficient for us to proceed with PR

@eh2077
Copy link
Contributor

eh2077 commented May 15, 2024

@GandalfGwaihir Thanks for the update!

I think we can go with @GandalfGwaihir 's proposal to move this issue forward.

Apart from fixing the specific case as described by this issue, I think we can also fix similar cases together. Yes, these cases also need backend fix.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented May 15, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 15, 2024
Copy link

melvin-bot bot commented May 15, 2024

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

Copy link

melvin-bot bot commented May 15, 2024

📣 @GandalfGwaihir 🎉 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 📖

@allgandalf
Copy link
Contributor

allgandalf commented May 16, 2024

@eh2077 I will open the PR over the weekend/ as soon as the BE issues are resolved, sorry for delay, due to the current site reliability issues with ND it's really difficult for me to test the changes, I am getting error every time I submit an expense or even try to approve it 😢 , will post when the PR is up

@allgandalf
Copy link
Contributor

PR ready for review @eh2077 , thanks for the patience

@allgandalf
Copy link
Contributor

@muttmuure , can you take a look at this comment from the PR once you find time :)

@yuwenmemon
Copy link
Contributor

As mentioned here, this issue was fixed by another PR while this one was on hold for the merge freeze. We'll still pay @GandalfGwaihir and @eh2077 for their fix though cc @muttmuure (https://stackoverflowteams.com/c/expensify/questions/8719)

@allgandalf
Copy link
Contributor

can you pay this one please @muttmuure :)

@muttmuure
Copy link
Contributor

All paid up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Archived in project
Development

No branches or pull requests

5 participants