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 - C+ only] [$1000] Workspace - Remove button is displayed active upon selecting admin to be deleted from workspace #20719

Closed
1 of 6 tasks
kbecciv opened this issue Jun 13, 2023 · 46 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 Jun 13, 2023

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


Action Performed:

1, Login to NewDot
2. Go to Workspace -> Members -> Invite
3. Select admin account

Expected Result:

Remove button should not look active

Actual Result:

Remove button is displayed active upon selecting admin to be deleted from workspace

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: 1.3.27.2

Reproducible in staging?: yes

Reproducible in production?: yes

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

Bug6091696_video_58.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b6a900eb33013827
  • Upwork Job ID: 1669443164980342784
  • Last Price Increase: 2023-06-15
@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 13, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 13, 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

@Nikhil-Vats
Copy link
Contributor

Nikhil-Vats commented Jun 13, 2023

Proposal

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

In workspace members page, the remove button is active when admin/logged in user is selected for removal which is not allowed.

What is the root cause of that problem?

The remove button is disabled only when there are no selected members. The condition for checking if admin/logged in user is selected is not added.

<Button
medium
danger
style={[styles.ml2]}
isDisabled={this.state.selectedEmployees.length === 0}
text={this.props.translate('common.remove')}
onPress={this.askForConfirmationToRemove}
/>

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

We need to add a new condition here to disable the button when either the logged in user or admin or both are selected. For that, we can use the following condition -

isDisabled={this.state.selectedEmployees.length === 0 || _.some(this.state.selectedEmployees, member => member === this.props.policy.owner || member === this.props.session.email)}

We can create a new function for this to make it more readable.

What alternative solutions did you explore? (Optional)

NA

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jun 14, 2023

Currently, We are facing this bug. My proposal will work well after this issue is resolved

Proposal

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

Workspace - Remove button is displayed active upon selecting admin to be deleted from workspace

What is the root cause of that problem?

isDisabled={this.state.selectedEmployees.length === 0}

We are checking that if this.state.selectedEmployees.length === 0 we will disable the remove button

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

We also should disable remove button if there is any error like that

   isDisabled={(this.state.selectedEmployees.length === 0) || !_.isEmpty(this.state.errors)}

It is similar to the check we did when clicking the remove button

askForConfirmationToRemove() {
if (!_.isEmpty(this.state.errors)) {
return;
}

Result

Screen.Recording.2023-06-14.at.14.32.15.mov

@NicMendonca
Copy link
Contributor

@kbecciv just to confirm, under the Expected Result you say that the remove should look active, but it should be that it should not display as active?

@kbecciv
Copy link
Author

kbecciv commented Jun 15, 2023

@NicMendonca Corrected, sorry for confusion

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Jun 15, 2023
@melvin-bot melvin-bot bot changed the title Workspace - Remove button is displayed active upon selecting admin to be deleted from workspace [$1000] Workspace - Remove button is displayed active upon selecting admin to be deleted from workspace Jun 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 2023

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

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

melvin-bot bot commented Jun 15, 2023

Current assignee @NicMendonca is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 2023

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

@rn-senior-developer
Copy link

Proposal

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

Workspace/Memeber - Remove button is displayed active upon selecting admin to be deleted from workspace

What is the root cause of that problem?

Remove buttons isDisabled property was active when user selected any users. It was not checked user role

isDisabled={this.state.selectedEmployees.length === 0}

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

We should check if admin is selected.
isDisabled={this.state.selectedEmployees.length === 0 || this.state.isSelectedAdmin}
To do this, I added isSelectedAdmin state.
isSelectedAdmin: false

And I passed the roleparameters in toggleUser event function, and set and reset isSelectedAdmin field when user select users on members list.

<Checkbox isChecked={isChecked} onPress={() => this.toggleUser(item.accountID, item.pendingAction, item.role)} />
....

onSelectRow={() => this.toggleUser(item.accountID, item.pendingAction, item.role)}

`toggleUser(accountID, pendingAction, role) {
if (pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
return;
}

    // Add or remove the user if the checkbox is enabled
    if (_.contains(this.state.selectedEmployees, Number(accountID))) {
        this.removeUser(Number(accountID));
        if (role === 'admin') {
            this.setState({ isSelectedAdmin : false})
        }
    } else {
        this.addUser(Number(accountID));
        if (role ==='admin') {
            this.setState({ isSelectedAdmin : true })
        }
    }
}`

And then, update the remove button's disabled props:

isDisabled={this.state.selectedEmployees.length === 0 || this.state.isSelectedAdmin}

What alternative solutions did you explore? (Optional)

Maybe, I can use session value to check if admin user selected.

Result Video

Screen.Recording.2023-06-15.at.5.36.45.PM.mov

@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 2023

📣 @jaytechfulldev! 📣
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>

@rn-senior-developer
Copy link

Contributor details
Your Expensify account email: samcheng955@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0192fff62d8b797dad

@melvin-bot
Copy link

melvin-bot bot commented Jun 15, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Jun 16, 2023
@sobitneupane
Copy link
Contributor

Thanks for proposal everyone.

Proposal from @dukenv0307 looks good to me.

🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Jun 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 19, 2023

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

@cead22
Copy link
Contributor

cead22 commented Jun 20, 2023

@sobitneupane @NicMendonca the proposal from @dukenv0307 looks good, but it doesn't feel like a complete solution, because we'll end up with a checkbox for the admin that doesn't do anything, and that isn't checked when Select All is checked, and that alone feels like a bug.

I think it would be better if we didn't show a checkbox for the admin, or if we showed it disabled. What do you think? cc @shawnborton

@rn-senior-developer
Copy link

@cead22 Can you check my proposal? I checked if Admin selected and even if user checked "All".

@shawnborton
Copy link
Contributor

I like the idea of showing it disabled.

@dukenv0307
Copy link
Contributor

@shawnborton @cead22 A little curios, if we always disable the admin checkbox, Users won't know why can't click the checkbox. Currently, when clicking the admin checkbox we are showing an error message to to notify to user
Screenshot 2023-06-20 at 21 59 47

@melvin-bot
Copy link

melvin-bot bot commented Jun 23, 2023

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

@melvin-bot

This comment was marked as duplicate.

@NicMendonca NicMendonca self-assigned this Jun 23, 2023
@NicMendonca
Copy link
Contributor

@Christinadobrzyn I am going OOO until Wednesday. Can you watch this while I am away? I'll unassign you when I am back. Thank you!

@Christinadobrzyn
Copy link
Contributor

Looks like we're reviewing the PR moving this to weekly

@melvin-bot
Copy link

melvin-bot bot commented Jun 28, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @dukenv0307 got assigned: 2023-06-23 17:53:55 Z
  • when the PR got merged: 2023-06-28 18:58:23 UTC
  • days elapsed: 3

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 Jul 3, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Workspace - Remove button is displayed active upon selecting admin to be deleted from workspace [HOLD for payment 2023-07-10] [$1000] Workspace - Remove button is displayed active upon selecting admin to be deleted from workspace Jul 3, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 3, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 3, 2023

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

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

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 Jul 3, 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.
  • [@NicMendonca] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@sobitneupane
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:

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

#14347

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

#14347 (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:

This was a design decision to allow users to select admin back then. So, I don't think this could have been caught earlier.

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

@sobitneupane
Copy link
Contributor

sobitneupane commented Jul 10, 2023

Regression Test Proposal

  1. Go to Settings> Workspaces
  2. Select any workspace > Members
  3. Try to select admin from the list.
  4. Verify that disabled cursor is displayed while hovering over the admin and admin cannot be selected.

Do we agree 👍 or 👎

@sobitneupane
Copy link
Contributor

Payment Requested on Expensify.

@NicMendonca
Copy link
Contributor

@dukenv0307 can you please apply to the job?

@dukenv0307
Copy link
Contributor

@NicMendonca I applied, thank you!

@NicMendonca
Copy link
Contributor

@dukenv0307 you've been paid!

@NicMendonca
Copy link
Contributor

@sobitneupane keep us posted!

@NicMendonca NicMendonca changed the title [HOLD for payment 2023-07-10] [$1000] Workspace - Remove button is displayed active upon selecting admin to be deleted from workspace [HOLD for payment - C+ only] [$1000] Workspace - Remove button is displayed active upon selecting admin to be deleted from workspace Jul 11, 2023
@NicMendonca
Copy link
Contributor

as per this SO, I can close! @sobitneupane you'll be paid shortly!

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

9 participants