Skip to content

[Due for payment 2025-02-25] [Due for payment 2025-02-19] [$250] Unable to leave a random workspace invited to #55462

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

Closed
1 of 8 tasks
m-natarajan opened this issue Jan 19, 2025 · 54 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item. Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Jan 19, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.87-0
Reproducible in staging?: need reproduction
Reproducible in production?: need reproduction
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @quinthar
Slack conversation (hyperlinked to channel name): expense

Action Performed:

  1. Get invited to a random workspace as a member role
  2. Go to workspace > Settings

Expected Result:

Should be able to remove from the workspace invited to as a member

Actual Result:

There is no way to get removed from the workspace

Workaround:

unknown

Platforms:

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

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Image

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021884532293307294606
  • Upwork Job ID: 1884532293307294606
  • Last Price Increase: 2025-01-29
  • Automatic offers:
    • shubham1206agra | Contributor | 105941625
    • huult | Contributor | 105976334
Issue OwnerCurrent Issue Owner: @JmillsExpensify
@m-natarajan m-natarajan added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Jan 19, 2025
Copy link

melvin-bot bot commented Jan 19, 2025

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

@m-natarajan m-natarajan added the Needs Reproduction Reproducible steps needed label Jan 19, 2025
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@shubham1206agra
Copy link
Contributor

Can repro. Please assign me C+ as per https://expensify.slack.com/archives/C02NK2DQWUX/p1737328646622939

Image

@huult
Copy link
Contributor

huult commented Jan 20, 2025

Proposal

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

Unable to quit from a random workspace invited to

What is the root cause of that problem?

New feature

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

We should create a feature that allows users to leave a workspace. To implement it, refer to this test branch

Test branch

I will explain what we will do to implement the leave workspace feature.

  1. Create a new leave button for policy members and show it only to policy members. This button should not be visible to policy admins.

https://github.com/huult/App/blob/8d8d217f10eb147d76af75438181d274c5af96dc/src/pages/workspace/WorkspaceProfilePage.tsx#L396-L406

    {isPolicyUser && readOnly && (
        // or {!(isAdmin || isOwner) && ( like https://github.com/Expensify/App/blob/46e252577d25630e33bc5e23f8992004b5d06ccb/src/pages/workspace/WorkspacesListPage.tsx#L198
        <View style={[styles.flexRow, styles.mt6, styles.mnw120]}>
            <Button
                accessibilityLabel={translate('common.leave')}
                text={translate('common.leave')}
                onPress={() => setIsLeaveModalOpen(true)}
                icon={Expensicons.Exit}
            />
        </View>
    )}
  1. Create a new state to show the confirm leave modal.

https://github.com/huult/App/blob/9135a62a75af04ed1deca14cbdc9636cb74e00de/src/pages/workspace/WorkspaceProfilePage.tsx#L164

https://github.com/huult/App/blob/9135a62a75af04ed1deca14cbdc9636cb74e00de/src/pages/workspace/WorkspaceProfilePage.tsx#L417-L426

    const [isLeaveModalOpen, setIsLeaveModalOpen] = useState(false);

    <ConfirmModal
        title={translate('common.leave')}
        isVisible={isLeaveModalOpen}
        onConfirm={confirmLeaveAndHideModal}
        onCancel={() => setIsLeaveModalOpen(false)}
        prompt={translate('workspace.common.leaveConfirmation')}
        confirmText={translate('common.leave')}
        cancelText={translate('common.cancel')}
        danger
    />
  1. Create a function for policy users to leave the workspace.

https://github.com/huult/App/blob/9135a62a75af04ed1deca14cbdc9636cb74e00de/src/pages/workspace/WorkspaceProfilePage.tsx#L186-L204

    const confirmLeaveAndHideModal = useCallback(() => {
        if (!policy?.id || !policyName) {
            return;
        }

        Policy.leaveWorkspace(policy.id);
        setIsDeleteModalOpen(false);

        // If the workspace being deleted is the active workspace, switch to the "All Workspaces" view
        if (activeWorkspaceID === policy.id) {
            setActiveWorkspaceID(undefined);
            Navigation.dismissModal();
            const rootState = navigationRef.current?.getRootState() as State<RootStackParamList>;
            const topmostBottomTabRoute = getTopmostBottomTabRoute(rootState);
            if (topmostBottomTabRoute?.name === SCREENS.SETTINGS.ROOT) {
                Navigation.setParams({policyID: undefined}, topmostBottomTabRoute?.key);
            }
        }
    }, [policy?.id, policyName, activeWorkspaceID, setActiveWorkspaceID]);
POC
Screen.Recording.2025-01-20.at.11.56.57.mp4

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

We create test for leaveWorksapce function

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@truph01
Copy link
Contributor

truph01 commented Jan 20, 2025

Proposal

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

  • There is no way to get removed from the workspace.

What is the root cause of that problem?

  • It is new feature.

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

  1. Display the "Leave" option in WorkspaceMemberDetailsPage:
  • We already have a logic to display the Remove from workspace button in here. We can add the Leave button here by updating this to:
                                    ) : !isCurrentUserAdmin && !isCurrentUserOwner && isSelectedMemberCurrentUser ? (
                                        <Button
                                            text={'Leave'}
                                            onPress={() => leaveWorkspace(policyID)}
                                            medium
                                            icon={Expensicons.RemoveMembers}
                                            iconStyles={StyleUtils.getTransformScaleStyle(0.8)}
                                            style={styles.mv5}
                                        />
                                    ) : (
                                        <Button
                                            text={translate('workspace.people.removeWorkspaceMemberButtonTitle')}
                                            onPress={askForConfirmationToRemove}
                                            isDisabled={isSelectedMemberOwner || isSelectedMemberCurrentUser}
                                            icon={Expensicons.RemoveMembers}
                                            iconStyles={StyleUtils.getTransformScaleStyle(0.8)}
                                            style={styles.mv5}
                                        />
  1. Allow current member to open:

Navigation.navigate(ROUTES.WORKSPACE_MEMBER_DETAILS.getRoute(route.params.policyID, item.accountID));

instead of:

Navigation.navigate(ROUTES.PROFILE.getRoute(item.accountID));

when they select themselves. Therefore, we can update:

if (!isPolicyAdmin || !PolicyUtils.isPaidGroupPolicy(policy)) {

            const isSelectedMemberCurrentUser = currentUserPersonalDetails.accountID === item.accountID;
            if ((!isSelectedMemberCurrentUser && !isPolicyAdmin) || !PolicyUtils.isPaidGroupPolicy(policy)) {
  • Then update:

accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}

            accessVariants={[isSelectedMemberCurrentUser ? undefined : CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

NA

What alternative solutions did you explore? (Optional)

Result

Screen.Recording.2025-01-20.at.15.08.56.mov

@garrettmknight garrettmknight moved this to Bugs and Follow Up Issues in #expensify-bugs Jan 21, 2025
@garrettmknight garrettmknight changed the title Unable to quit from a random workspace invited to Unable to leave a random workspace invited to Jan 21, 2025
@melvin-bot melvin-bot bot added the Overdue label Jan 22, 2025
Copy link

melvin-bot bot commented Jan 23, 2025

@JmillsExpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@shubham1206agra
Copy link
Contributor

shubham1206agra commented Jan 23, 2025

@JmillsExpensify Can you assign me C+ here as per #55462 (comment) so I can approve @huult's proposal?

Edit - There seems to be additional cases we need to cover in this issue.

@shubham1206agra
Copy link
Contributor

Additional cases to handle -

Allow anyone to leave the workspace except users who met any of the following conditions:

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

@shubham1206agra
Copy link
Contributor

@huult @truph01 Can you update your proposals to handle these cases?
#55462 (comment)

Mock

Image

@huult
Copy link
Contributor

huult commented Jan 23, 2025

@shubham1206agra We will adjust the condition here to display the leave button for each case

@huult
Copy link
Contributor

huult commented Jan 23, 2025

Currently, I am checking the leave button if it is not isAdmin || isOwner

@shubham1206agra
Copy link
Contributor

@huult I am afraid you need to give more details than that to get your proposal completed

@Shahidullah-Muffakir
Copy link
Contributor

Is it really a bug? , because we already have the Leave option in the three-dot menu for the above mentioned condition.
Do we want to add the same Leave button in the footer of WorkspaceProfilePage ?

Screen.Recording.2025-01-24.at.6.16.22.PM.mov

@shubham1206agra
Copy link
Contributor

Is it really a bug? , because we already have the Leave option in the three-dot menu for the above mentioned condition. Do we want to add the same Leave button in the footer of WorkspaceProfilePage ?
Screen.Recording.2025-01-24.at.6.16.22.PM.mov

@Shahidullah-Muffakir It is more of a feature request right now.

Copy link

melvin-bot bot commented Jan 27, 2025

@JmillsExpensify Still overdue 6 days?! Let's take care of this!

Copy link

melvin-bot bot commented Jan 29, 2025

@JmillsExpensify 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label Jan 29, 2025
Copy link

melvin-bot bot commented Jan 29, 2025

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

@melvin-bot melvin-bot bot changed the title Unable to leave a random workspace invited to [$250] Unable to leave a random workspace invited to Jan 29, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 29, 2025
@JmillsExpensify JmillsExpensify removed Needs Reproduction Reproducible steps needed Help Wanted Apply this label when an issue is open to proposals by contributors labels Jan 29, 2025
@melvin-bot melvin-bot bot added the Weekly KSv2 label Feb 4, 2025
@dangrous
Copy link
Contributor

dangrous commented Feb 7, 2025

@Expensify/marketing could we get some 👀 on copy for this please? Just for the button ("Leave workspace" seems easy enough) and then for the confirmation pop up - something like Are you sure you want to leave this workspace? Once you leave, you will lose access to all data and settings associated with this workspace.?

Thank you!

@jamesdeanexpensify
Copy link
Contributor

I like it! Small tweak but we can say "...you'll lose access..."

@dangrous
Copy link
Contributor

oh sorry one more @jamesdeanexpensify - do we want just Leave (as in the mocks) or Leave Workspace?

@jamesdeanexpensify
Copy link
Contributor

Leave works! We have other one-word actions in the same place:

Image

@dangrous
Copy link
Contributor

Adding approved EN and ES here:

Button:

  • EN - Leave
  • ES - Salir (this already exists in the translation files)

Modal:

  • EN - Are you sure you want to leave this workspace? Once you leave, you'll lose access to all data and settings associated with this workspace.
  • ES - ¿Estás seguro de que quieres salir de este espacio de trabajo? Una vez que salgas, perderás el acceso a todos los datos y configuraciones asociadas con este espacio de trabajo.

@trjExpensify
Copy link
Contributor

Once you leave, you'll lose access to all data and settings associated with this workspace.

I don't think that's true. You, for example, keep access to your expense reports. What's the warning message copy we show on OldDot?

@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 Bugs and Follow Up Issues to Done in #expensify-bugs Feb 12, 2025
@huult
Copy link
Contributor

huult commented Feb 12, 2025

@trjExpensify Can I ask about the payment for this ticket?

As mentioned in this comment, can I receive any payment now, or will I receive the payment once this issue is complete?

@trjExpensify
Copy link
Contributor

We're reverting the PR as it'll cause regressions, so once #56750 is complete.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 12, 2025
@melvin-bot melvin-bot bot changed the title [$250] Unable to leave a random workspace invited to [Due for payment 2025-02-19] [$250] Unable to leave a random workspace invited to Feb 12, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 12, 2025
Copy link

melvin-bot bot commented Feb 12, 2025

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

Copy link

melvin-bot bot commented Feb 12, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.97-1 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 2025-02-19. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Feb 12, 2025

BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@shubham1206agra] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
  • [@JmillsExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Feb 18, 2025
@melvin-bot melvin-bot bot changed the title [Due for payment 2025-02-19] [$250] Unable to leave a random workspace invited to [Due for payment 2025-02-25] [Due for payment 2025-02-19] [$250] Unable to leave a random workspace invited to Feb 18, 2025
Copy link

melvin-bot bot commented Feb 18, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.99-2 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 2025-02-25. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Feb 18, 2025

BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@shubham1206agra] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
  • [@JmillsExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.

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 External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item. Weekly KSv2
Projects
Status: Done
Development

No branches or pull requests