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-10-29][$125] [Search v1.2] - Admin can delete employee's expenses in Search page #46762

Closed
6 tasks done
lanitochka17 opened this issue Aug 3, 2024 · 68 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

@lanitochka17
Copy link

lanitochka17 commented Aug 3, 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.16-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/A
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • Admin and employee are in the same workspace
  1. Go to staging.new.expensify.com
  2. [Employee] Submit an expense in the workspace chat
  3. [Admin] Go to Search
  4. [Admin] Select the expense submitted by employee via checkbox
  5. [Admin] Click on the dropdown

Expected Result:

Delete option should not be available for admin in Search because Delete option is not present for admin in the transaction thread

Actual Result:

Delete option is available for admin in Search when Delete option is not present for admin in the transaction thread

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

Bug6560363_1722618441824.20240803_005930.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018f10851e4c993906
  • Upwork Job ID: 1821118379211606096
  • Last Price Increase: 2024-10-29
Issue OwnerCurrent Issue Owner: @Pujan92
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 3, 2024
Copy link

melvin-bot bot commented Aug 3, 2024

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

We think that this bug might be related to #wave-control

@lanitochka17
Copy link
Author

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

@MuaazArshad
Copy link
Contributor

MuaazArshad commented Aug 3, 2024

Edited by proposal-police: This proposal was edited at 2023-10-04T16:01:00Z.

Proposal

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

Admin can delete employee's expenses in Search page

What is the root cause of that problem?

We are not hiding the delete option from the admin here. This option should only be available to the action creator. We are not adding the check isActionCreator here

const shouldShowDeleteOption = !isOffline && selectedTransactionsKeys.every((id) => selectedTransactions[id].canDelete);

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

We should check if the current user is action creator we can do something like this

        const shouldShowDeleteOption = !isOffline && selectedTransactionsKeys.every((id) => selectedTransactions[id].canDelete) && isActionCreator;

What alternative solutions did you explore? (Optional)

In case we only want to prevent the admin admin from deleting, we can add an isPolicyAdmin check.

Copy link

melvin-bot bot commented Aug 3, 2024

📣 @MuaazArshad! 📣
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. Make sure you've read and understood the contributing guidelines.
  2. 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.
  3. 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.
  4. 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>

Copy link
Contributor

github-actions bot commented Aug 3, 2024

Expensifybot Your proposal will be dismissed because you did not follow the proposal template.

@MuaazArshad
Copy link
Contributor

Contributor details
Your Expensify account email: mooeez.arshad@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~017994bec44c81b9d0

Copy link

melvin-bot bot commented Aug 3, 2024

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

@daledah
Copy link
Contributor

daledah commented Aug 5, 2024

Proposal

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

Delete option is available for admin in Search when Delete option is not present for admin in the transaction thread

What is the root cause of that problem?

Here is the condition to display delete option in report detail page:

const canDeleteRequest = isActionOwner && (ReportUtils.canDeleteTransaction(moneyRequestReport) || isSelfDMTrackExpenseReport) && !isDeletedParentAction;

and here is the condition to display delete option in search page:
const shouldShowDeleteOption = !isOffline && selectedTransactionsKeys.every((id) => selectedTransactions[id].canDelete);

in there, canDelete is returned by BE and its value is true

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

Should make sure, if user is admin, use is able to delete expense by updating

const canDeleteRequest = isActionOwner && (ReportUtils.canDeleteTransaction(moneyRequestReport) || isSelfDMTrackExpenseReport) && !isDeletedParentAction;

to

    const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
    const canDeleteRequest = (isActionOwner || isAdmin) && (ReportUtils.canDeleteTransaction(moneyRequestReport) || isSelfDMTrackExpenseReport) && !isDeletedParentAction;

@dylanexpensify
Copy link
Contributor

reviewing today!

@dylanexpensify dylanexpensify added the External Added to denote the issue can be worked on by a contributor label Aug 7, 2024
Copy link

melvin-bot bot commented Aug 7, 2024

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

@melvin-bot melvin-bot bot changed the title Search - Admin can delete employee's expenses in Search page [$250] Search - Admin can delete employee's expenses in Search page Aug 7, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 7, 2024
Copy link

melvin-bot bot commented Aug 7, 2024

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

@dylanexpensify
Copy link
Contributor

Made external

Copy link

melvin-bot bot commented Aug 12, 2024

@Pujan92, @dylanexpensify Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Aug 12, 2024
@Pujan92
Copy link
Contributor

Pujan92 commented Aug 13, 2024

@dylanexpensify Can you plz help to decide the expected behavior?

Are expenses can be deleted by admin from both places or we shouldn't allow delete operation to admin from both places?

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

melvin-bot bot commented Aug 14, 2024

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

@MuaazArshad
Copy link
Contributor

@Pujan92 @dylanexpensify bump!

@melvin-bot melvin-bot bot added the Overdue label Aug 16, 2024
Copy link

melvin-bot bot commented Aug 16, 2024

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

Copy link

melvin-bot bot commented Aug 17, 2024

@Pujan92 @dylanexpensify 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!

Copy link

melvin-bot bot commented Aug 20, 2024

@Pujan92, @dylanexpensify 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@luacmartins
Copy link
Contributor

No updates yet, gonna try to work on it this week.

@melvin-bot melvin-bot bot removed the Overdue label Oct 15, 2024
@luacmartins luacmartins added the Reviewing Has a PR in review label Oct 16, 2024
@luacmartins
Copy link
Contributor

PR in review

@dylanexpensify dylanexpensify removed their assignment Oct 17, 2024
@dylanexpensify dylanexpensify added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Oct 17, 2024
Copy link

melvin-bot bot commented Oct 17, 2024

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

@dylanexpensify
Copy link
Contributor

Hey @sonialiap! I'm heading out on parental leave so reassigning this! TY! 🙇‍♂️

Copy link

melvin-bot bot commented Oct 25, 2024

@Pujan92, @sonialiap, @luacmartins, @daledah Whoops! This issue is 2 days overdue. Let's get this updated quick!

@Pujan92
Copy link
Contributor

Pujan92 commented Oct 29, 2024

@luacmartins @stitesExpensify I would like to just confirm whether we are eligible for any compensation here because based on the initial confirmation of requirements we proceeded and merged the PR.

@luacmartins luacmartins changed the title [$250] [Search v1.2] - Admin can delete employee's expenses in Search page [$125] [Search v1.2] - Admin can delete employee's expenses in Search page Oct 29, 2024
Copy link

melvin-bot bot commented Oct 29, 2024

Upwork job price has been updated to $125

@luacmartins
Copy link
Contributor

Sure, but I think it'd be 50% of the amount since it technically caused a regression.

@luacmartins luacmartins changed the title [$125] [Search v1.2] - Admin can delete employee's expenses in Search page [HOLD for payment 2024-10-29][$125] [Search v1.2] - Admin can delete employee's expenses in Search page Oct 29, 2024
@luacmartins luacmartins added Awaiting Payment Auto-added when associated PR is deployed to production and removed Reviewing Has a PR in review labels Oct 29, 2024
@Pujan92
Copy link
Contributor

Pujan92 commented Oct 29, 2024

Agree @luacmartins, Thanks!

@sonialiap can you plz post payment summary

Copy link

melvin-bot bot commented Oct 29, 2024

Payment Summary

Upwork Job

  • Reviewer: @Pujan92 owed $250 via NewDot
  • ROLE: @daledah paid $(AMOUNT) via Upwork (LINK)

BugZero Checklist (@sonialiap)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1821118379211606096/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@sonialiap
Copy link
Contributor

sonialiap commented Oct 30, 2024

Payment summary:

@melvin-bot melvin-bot bot added the Overdue label Nov 1, 2024
@sonialiap
Copy link
Contributor

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:

  •  [@Pujan92] The PR that introduced the bug has been identified. Link to the PR:
  •  [@Pujan92] 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:
  •  [@Pujan92] 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:
  •  [@Pujan92] Determine if we should create a regression test for this bug.
  •  [@Pujan92] 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.
  •  [@sonialiap] 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 Overdue Daily KSv2 labels Nov 4, 2024
@garrettmknight
Copy link
Contributor

@Pujan92 can you complete the checklist?

@Pujan92
Copy link
Contributor

Pujan92 commented Nov 6, 2024

@garrettmknight We don't need a checklist here as the expected behavior has been changed and PR for this is reverted, BE fix only required.

@garrettmknight
Copy link
Contributor

$125 approved for @Pujan92

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
Status: Done
Development

No branches or pull requests

9 participants