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

[Simple AA in NewDot] No option to leave workspace as non-owner #43508

Closed
6 tasks done
m-natarajan opened this issue Jun 11, 2024 · 66 comments
Closed
6 tasks done

[Simple AA in NewDot] No option to leave workspace as non-owner #43508

m-natarajan opened this issue Jun 11, 2024 · 66 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Hot Pick Ready for an engineer to pick up and run with Internal Requires API changes or must be handled by Expensify staff Monthly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Jun 11, 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.81-8
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
Expensify/Expensify Issue URL:
Issue reported by: @Beamanator
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1718092341741619

Action Performed:

  1. As User A, create policy in NewDot
  2. Invite two other users. Promote User B to workspace admin, and leave User C as a regular user
  3. Log in as User B
  4. Open workspace members page & try to leave the workspace
  5. Log in as User C
  6. Open workspace members page & try to leave the workspace
    Expected Result: Both User B and User C should be able to leave the workspace

Expected Result:

There should be a way for a workspace non-owner to leave a workspace.

Actual Result:

There's no way for either of the workspace non-owners to leave the workspace.

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

Screen.Recording.2024-06-11.at.10.50.01.AM.mov

Snip - (60) New Expensify - Google Chrome

View all open jobs on GitHub

@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 11, 2024
Copy link

melvin-bot bot commented Jun 11, 2024

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

@truph01
Copy link
Contributor

truph01 commented Jun 12, 2024

Proposal

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

  • There should be a way for a non-owner workspace admin to leave a workspace.

What is the root cause of that problem?

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

  • We can display the Button having the title "Leave" and when pressing on it, call Policy.leaveWorkspace(policyID ?? ''). This button is only displayed if current user is admin and not a owner. To do that, we can update logic:
  • ) : (
    <Button
    text={translate('workspace.people.removeMemberButtonTitle')}
    onPress={askForConfirmationToRemove}
    medium
    isDisabled={isSelectedMemberOwner || isSelectedMemberCurrentUser}
    icon={Expensicons.RemoveMembers}
    iconStyles={StyleUtils.getTransformScaleStyle(0.8)}
    style={styles.mv5}
    />
    )}

    to:
) : isCurrentUserAdmin && !isCurrentUserOwner ? (
                            <Button
                                text={'Leave'}
                                onPress={() => Policy.leaveWorkspace(policyID)}
                                medium
                                icon={Expensicons.RemoveMembers}
                                iconStyles={StyleUtils.getTransformScaleStyle(0.8)}
                                style={styles.mv5}
                            />
                        ) : (
                            <Button
                                text={translate('workspace.people.removeMemberButtonTitle')}
                                onPress={askForConfirmationToRemove}
                                medium
                                isDisabled={isSelectedMemberOwner || isSelectedMemberCurrentUser}
                                icon={Expensicons.RemoveMembers}
                                iconStyles={StyleUtils.getTransformScaleStyle(0.8)}
                                style={styles.mv5}
                            />
                        )}
  • We should add "Leave" option to this logic:
    const getMenuItem = useCallback(

    if current user is admin but not owner as well.
  • Then BE need to fix the LeavePolicy API so that non owner admin can leave workspace.

What alternative solutions did you explore? (Optional)

  • With the member of the workspace who is not admin or owner, we also need to display "Leave" option which allows them to leave workspace as well because we already displayed "Leave" option in WorkspaceListPage if user is not admin and owner:
    if (!(isAdmin || isOwner)) {
    threeDotsMenuItems.push({
    icon: Expensicons.ChatBubbles,
    text: translate('common.leave'),
    onSelected: Session.checkIfActionIsAllowed(() => Policy.leaveWorkspace(item.policyID ?? '')),
    });
    }

@devguest07
Copy link
Contributor

Proposal

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

Admin is not able to remove himself from a workspace.

What is the root cause of that problem?

On the WorkspaceMemberDetailsPage, the "Remove from workspace" button is disabled when the selected member is the same user.

isDisabled={isSelectedMemberOwner || isSelectedMemberCurrentUser}

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

As requested in this issue, we should not disable the "Remove from workspace" button for the user.

We can remove the isSelectedMemberCurrentUser check.

isDisabled={isSelectedMemberOwner || isSelectedMemberCurrentUser}

We can modify the isSelectedMemberCurrentUser check to ensure the user is an admin. If the selected member is the same user and he is an admin isCurrentUserAdmin, we should not disable the "Remove from workspace" button.

What alternative solutions did you explore?

@Beamanator
Copy link
Contributor

FYI we haven't added the Help Wanted label yet b/c we're still designing out exactly how we want this to work, so I wouldn't recommend adding proposals yet 😅

@melvin-bot melvin-bot bot added the Overdue label Jun 14, 2024
@johncschuster
Copy link
Contributor

Thanks for the update, @Beamanator. In that case, should this be Daily?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jun 14, 2024
@johncschuster
Copy link
Contributor

@Beamanator, did the discussion land on this?

@melvin-bot melvin-bot bot removed the Overdue label Jun 18, 2024
@Beamanator
Copy link
Contributor

Fair, maybe weekly is better 😅 I have been OOO yesterday and most of last friday so i have some stuff to catch up on, but the latest should be in the linked slack thread! I can try to look at this today soonish as well :D

@johncschuster
Copy link
Contributor

Discussion is still ongoing in Slack (looks like we're close to a path forward).

Setting this to Weekly for now.

@johncschuster
Copy link
Contributor

I think this fits under #wave-collect. @trjExpensify, would you agree?

@trjExpensify
Copy link
Contributor

Did we conclude on this? #43508 (comment)

Seems like it would be something we put in #wave-control and track with that to solve allowing anyone that's not the owner to freely leave a workspace.

Copy link

melvin-bot bot commented Jun 25, 2024

@johncschuster this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Jul 2, 2024
@johncschuster
Copy link
Contributor

johncschuster commented Jul 2, 2024

Did we conclude on this? #43508 (comment)

I think we did! @Beamanator, as far as I can tell, this comment is the path forward, right? If so, can you give us a summary?

@melvin-bot melvin-bot bot removed the Overdue label Jul 2, 2024
@Beamanator
Copy link
Contributor

Nice, ya i think so!

So for the External part of this issue, it looks like basically just want to:

  1. Give non-owner admins the ability to Leave workspaces
  2. The "Leave" button should be in the 3-dot menu

Now the possibly interesting thing is: Once we implement this being possible, if a non-owner admin in a Control workspace see a warning about themselves being replaced with the Owner, in every member's policy chain? I kinda assume not, we'll just do that automatically?

@melvin-bot melvin-bot bot added the Overdue label Jul 11, 2024
@johncschuster
Copy link
Contributor

@trjExpensify ^^

Given we've come to a conclusion, how about we switch this back to Daily and throw on Help Wanted?

@johncschuster
Copy link
Contributor

Thanks! I'm happy to stay on as the BZ 👍 Just wanted to get a sense check so I could apply the right level of urgency. I'll keep it bumping!

@johncschuster
Copy link
Contributor

Giving this a Melvbump since I'll be OOO tomorrow and Friday. Not overdue

@johncschuster
Copy link
Contributor

Happy Monday! I'm back with another Melvinbump.

@johncschuster
Copy link
Contributor

Bumping for Melv 👍

@johncschuster
Copy link
Contributor

Bumping again to keep Melv at bay

@johncschuster
Copy link
Contributor

I'm OOO starting Monday, December 23, and will be returning Monday, January 6. I'll keep this bumping then!

@melvin-bot melvin-bot bot added the Overdue label Dec 30, 2024
@johncschuster
Copy link
Contributor

Hello everyone! I'm back from break! 👋

@melvin-bot melvin-bot bot removed the Overdue label Jan 6, 2025
@johncschuster
Copy link
Contributor

Okay, it looks like I'm the only assignee at the moment, and this issue is still low priority. I'm going to downgrade the label to Monthly for now and keep it bumping so it doesn't get eroded.

We'll increase the priority again when the time is right 👍

@johncschuster johncschuster added Monthly KSv2 and removed Weekly KSv2 labels Jan 13, 2025
@quinthar
Copy link
Contributor

Can we expand this to allow anyone to leave (except the owner), including both admins and members? More info here:

https://expensify.slack.com/archives/C06ML6X0W9L/p1737402644808479?thread_ts=1737153983.772019&cid=C06ML6X0W9L

@johncschuster
Copy link
Contributor

Sounds good! I've updated the expected results in the OP as well as the repro/testing steps:

Action Performed:

  1. As User A, create workspace in NewDot
  2. Invite two other users. Promote User B to workspace admin, and leave User C as a regular user
  3. Log in as User B
  4. Open workspace members page & try to leave the workspace
  5. Log in as User C
  6. Open workspace members page & try to leave the workspace
    Expected Result: Both User B and User C should be able to leave the workspace

Expected Result:

There should be a way for a workspace non-owner to leave a workspace.

Actual Result:

There's no way for either of the workspace non-owners to leave the workspace.

@johncschuster
Copy link
Contributor

Ah! Jason made a great callout, here. I will need to update the OP to account for the following scenarios:

  • Admins who are locked to policies via domain control
  • Admins who are the designated reimbursers
  • Admins who are the designated technical contact

@trjExpensify
Copy link
Contributor

Yeah, and let's make sure we handle them appropriately.

@garrettmknight garrettmknight changed the title [Simple AA in NewDot] No option to leave workspace as non owner admin [Simple AA in NewDot] No option to leave workspace as non-owner Jan 28, 2025
@dangrous
Copy link
Contributor

Hi! Wanted to sync up on this issue vs. this issue since it seems like they're basically the same. Should we consolidate?

@trjExpensify
Copy link
Contributor

Yeah, I think consolidate makes sense. I wrote out some thoughts on the different cases and handling them a while back in this comment.

@dylanexpensify dylanexpensify moved this from Bugs and Follow Up Issues to Hotter picks in [#whatsnext] #expense Feb 4, 2025
@johncschuster
Copy link
Contributor

It looks like we may not be consolidating these issues after all (per this comment in Slack)

@dangrous
Copy link
Contributor

dangrous commented Feb 12, 2025

@MonilBhavsar do you have a moment to look at this? It looks like the functionality already exists (I saw you made the LeavePolicy command in Auth), just wasn't implemented fully in New Dot? Trying to sort out these long chains of comments. Thanks!

EDIT: to be clear, I'm just trying to sort out what still needs to be done here. I think it's just showing/not showing the "leave" button in the appropriate situations, right? No backend work?

@MonilBhavsar
Copy link
Contributor

MonilBhavsar commented Feb 12, 2025

I think it's just showing/not showing the "leave" button in the appropriate situations, right? No backend work?

That sounds right.

We had an option to Leave policy in the three dot menu
Please see video in test section in this PR https://github.com/Expensify/Auth/pull/10245

That seems to be removed somehow, so yes we need to add a button and call the API. That should hopefully do it

Oh, I was looking as the policy owner. We still have the option to leave the workspace and it works fine

@trjExpensify
Copy link
Contributor

Ah, FYI, I just commented on the app PR.

@trjExpensify
Copy link
Contributor

I'm going to take over managing this, and consolidating #43508 and #55462 to #56750.

@github-project-automation github-project-automation bot moved this from Hotter picks to Done in [#whatsnext] #expense Feb 12, 2025
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. Hot Pick Ready for an engineer to pick up and run with Internal Requires API changes or must be handled by Expensify staff Monthly KSv2
Projects
Status: Done
Development

No branches or pull requests

10 participants