App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-12-15] “Cannot remove yourself from workspace” banner is shown over and over again while inviting a new member - Reported by: @aswin-s

Open isagoico opened this issue 5 years ago • 15 comments

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


Action Performed:

  1. Navigate to add member screen
  2. Tap on check box against own account once.
  3. Now tap on invite button to invite a new member
  4. The banner keeps on popping up.
  5. Even sending app to background and resuming or swiping down from notification panel also shows same behaviour.

Expected Result:

Banner notifying the user that own account can't be removed from workspace should show only one.

Actual Result:

Banner keeps showing up after clicking on invite button.

Workaround:

Force closing and reopening the app fixes the issue.

Platform:

Where is this issue occurring?

  • iOS
  • Android
  • Mobile Web

Version Number: 1.1.14-0

Reproducible in staging?: Yes Reproducible in production?: Yes

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

https://user-images.githubusercontent.com/44479856/141533150-4efe7d47-86af-4cc8-b2e8-def1047a7601.MP4

Upwork job post: https://www.upwork.com/jobs/~01a1b16b70fceaf5f1

Issue reported by: @aswin-s Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1636709473156600

View all open jobs on GitHub

isagoico avatar Nov 12 '21 20:11 isagoico

Triggered auto assignment to @sketchydroide (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Nov 12 '21 20:11 MelvinBot

For some reason, I am not able to reproduce this by following the given reproduction steps. I am unable to click the own admin checkbox itself. It shows the following tooltip. @isagoico Can you help with some clarity on the reproduction steps?

image

akshayasalvi avatar Nov 14 '21 04:11 akshayasalvi

My bad! I just updated the platforms affected. This is only reproducible in mobile.

isagoico avatar Nov 15 '21 02:11 isagoico

Thanks @isagoico.

This definetly sounds like a bug, specialy for being platform specific. Also setting this as an external.

sketchydroide avatar Nov 15 '21 11:11 sketchydroide

Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

MelvinBot avatar Nov 15 '21 11:11 MelvinBot

Proposed Solution:

Here is the Problem: It is calling componentDidUpdate() method when goes to background. https://github.com/Expensify/App/blob/6701446b6dd7d77049fd399dcf6a042e6d05cae1/src/components/CheckboxWithTooltip/CheckboxWithTooltipForMobileWebAndNative.js#L14-L20

Solution: Put condition at line 19 i.e. If toggleTooltip change run Growl, otherwise not. This will correct the issue.

componentDidUpdate(prevProps) {
    if (!this.props.toggleTooltip) {
        return;
    }

    if (prevProps.toggleTooltip !== this.props.toggleTooltip) {
        Growl.show(this.props.text, this.props.growlType, 3000);
    }
}

Here is screen record, it works as expected with this solution:

iOS

https://user-images.githubusercontent.com/7823358/141803738-a9f48c97-d643-49c0-bb21-513fcd1fd91f.mov

Android

https://user-images.githubusercontent.com/7823358/141804110-6921ea00-99d4-44bb-9bf6-12fca15f9b71.mp4

Mobile Web

https://user-images.githubusercontent.com/7823358/141803880-76bc08db-b49d-4260-b083-79fe99ef47db.mov

PrashantMangukiya avatar Nov 15 '21 15:11 PrashantMangukiya

Proposal

This bug is occurring because in willTooltipShowForLogin function, in case when workspace owner wants to remove himself, this code this.setState({showTooltipForLogin: login}); allows to show popUp, but showTooltipForLogin state variable's value will be always login and popup will be shown over and over again.

https://github.com/Expensify/App/blob/6701446b6dd7d77049fd399dcf6a042e6d05cae1/src/pages/workspace/WorkspaceMembersPage.js#L154-L156

The simpest way to fix it is to set showTooltipForLogin variable value " " after popUp was shown first time, like this:

if (!canBeRemoved) {
            this.setState({showTooltipForLogin: login});
            setTimeout(() => this.setState({showTooltipForLogin: ''}), 100);
        }

https://user-images.githubusercontent.com/71173662/141808605-635fd59a-953a-41cc-a64c-405428c34755.MP4

https://user-images.githubusercontent.com/71173662/141814747-e033fea1-cd39-4a1d-8e4b-61f1f7a674f0.mp4

https://user-images.githubusercontent.com/71173662/141815505-1897643e-8a11-4f58-98c6-741d31c7d6ee.mov

developvsn avatar Nov 15 '21 15:11 developvsn

Upwork job post: https://www.upwork.com/jobs/~01a1b16b70fceaf5f1

  • ✅ I hired @aswin-s, so that they are paid the bug reporting bonus (i.e. if/when this bug is fixed).
  • Next, I'll hire the contributor we choose to actually solve the problem. Looks like @PrashantMangukiya's proposal is the first to review.

We should have 2 hires for this job basically.

michaelhaxhiu avatar Nov 17 '21 13:11 michaelhaxhiu

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

MelvinBot avatar Nov 17 '21 13:11 MelvinBot

@PrashantMangukiya I like your proposal! https://github.com/Expensify/App/issues/6287#issuecomment-968998459 let's go with that.

johnmlee101 avatar Nov 30 '21 15:11 johnmlee101

📣 @PrashantMangukiya You have been assigned to this job by @johnmlee101! Please apply to this job in Upwork and let us know when we can expect a PR to be ready for review 🧑‍💻 Keep in mind: Code of Conduct | Contributing 📖

MelvinBot avatar Nov 30 '21 15:11 MelvinBot

Next, I'll hire the contributor we choose to actually solve the problem. Looks like @PrashantMangukiya's proposal is the first to review.

Done ✅ - @PrashantMangukiya you are hired on Upwork.

michaelhaxhiu avatar Nov 30 '21 16:11 michaelhaxhiu

Thanks @michaelhaxhiu Preparing pr now and submit asap.

PrashantMangukiya avatar Nov 30 '21 16:11 PrashantMangukiya

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.1.18-3 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/6542

If no regressions arise, payment will be issued on 2021-12-15. :confetti_ball:

botify avatar Dec 08 '21 19:12 botify

Both contributors are paid.

michaelhaxhiu avatar Dec 15 '21 14:12 michaelhaxhiu