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

Desktop - Offline - Error message while inviting user to the Workspace #10552

Closed
kbecciv opened this issue Aug 24, 2022 · 16 comments
Closed

Desktop - Offline - Error message while inviting user to the Workspace #10552

kbecciv opened this issue Aug 24, 2022 · 16 comments
Assignees

Comments

@kbecciv
Copy link

kbecciv commented Aug 24, 2022

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. Open Desktop App
  2. Go to Setting - Workspace - Members
  3. Turn off the network
  4. Try to invite user to the workspace

Expected Result:

Member should be added to the list and still present once device is online

Actual Result:

Error message appears: "An error occurred inviting the user to the workspace, please try again"

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Desktop App

Version Number: 1.1.89.0

Reproducible in staging?: Yes

Reproducible in production?: No

Email or phone of affected tester (no customers): any

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

Notes/Photos/Videos: Any additional supporting documentation

Bug5702650_Screen_Recording_2022-08-24_at_20.53.02.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Aug 24, 2022
@kbecciv kbecciv changed the title Desktop - Desktop - Offline - Error message while inviting user to the Workspace Desktop - Offline - Error message while inviting user to the Workspace Aug 24, 2022
@OSBotify
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@melvin-bot
Copy link

melvin-bot bot commented Aug 24, 2022

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

@ctkochan22
Copy link
Contributor

Wait, is this a blocker? Is the refactor out for this?

Seems like offline handling will be handled in the refactor?

@ctkochan22
Copy link
Contributor

ctkochan22 commented Aug 24, 2022

cc @arosiclair

@ctkochan22
Copy link
Contributor

@kbecciv How are you "turning the network off" specifically?

@kbecciv
Copy link
Author

kbecciv commented Aug 25, 2022

@ctkochan22 Yes, QA team was following the steps in TR.

@ctkochan22
Copy link
Contributor

Okay. I was just wondering. I tried with using the Network tab in the developer console for desktop and wasn't able to reproduce. Let me try turning off the wifi

@ctkochan22
Copy link
Contributor

ctkochan22 commented Aug 25, 2022

Tried turning my computer wifi off. Button is working as expected. Disabled.
image

The WorkspaceInvitePage just has the FormAlertWithSubmitButton button implemented. I don't see anything in the code that would do something like "Member should be added to the list and still present once device is online"

@sketchydroide
Copy link
Contributor

I can't replicate this as well, in fact the green button is not even enabled while in offline mode

@roryabraham
Copy link
Contributor

roryabraham commented Aug 25, 2022

Not able to reproduce this either

@sketchydroide
Copy link
Contributor

Removing the blocker, @kbecciv can you please test again on the latest version

@sketchydroide sketchydroide added Weekly KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Aug 25, 2022
@neil-marcellini
Copy link
Contributor

I was able to reproduce on desktop staging v1.1.89-2

Offline
image

Back online
image

@mountiny
Copy link
Contributor

I think this command is not using a new API yet:

/**
* Merges the passed in login into the specified policy
*
* @param {Array<String>} logins
* @param {String} welcomeNote
* @param {String} policyID
*/
function invite(logins, welcomeNote, policyID) {
const key = `${ONYXKEYS.COLLECTION.POLICY}${policyID}`;
const newEmployeeList = _.map(logins, login => OptionsListUtils.addSMSDomainIfPhoneNumber(login));
// Make a shallow copy to preserve original data, and concat the login
const policy = _.clone(allPolicies[key]);
policy.employeeList = [...policy.employeeList, ...newEmployeeList];
policy.alertMessage = '';
// Optimistically add the user to the policy
Onyx.merge(key, policy);
// Make the API call to merge the login into the policy
DeprecatedAPI.Policy_Employees_Merge({
employees: JSON.stringify(_.map(logins, login => ({email: login}))),
welcomeNote,
policyID,
})
.then((data) => {
// Save the personalDetails for the invited user in Onyx and fetch the latest policyExpenseChats
if (data.jsonCode === 200) {
Onyx.merge(ONYXKEYS.PERSONAL_DETAILS, PersonalDetails.formatPersonalDetails(data.personalDetails));
Navigation.goBack();
if (!_.isEmpty(data.policyExpenseChatIDs)) {
Report.fetchChatReportsByIDs(data.policyExpenseChatIDs);
}
return;
}
// If the operation failed, undo the optimistic addition
const policyDataWithoutLogin = _.clone(allPolicies[key]);
policyDataWithoutLogin.employeeList = _.without(allPolicies[key].employeeList, ...newEmployeeList);
// Show the user feedback that the addition failed
policyDataWithoutLogin.alertMessage = Localize.translateLocal('workspace.invite.genericFailureMessage');
if (data.jsonCode === 402) {
policyDataWithoutLogin.alertMessage += ` ${Localize.translateLocal('workspace.invite.pleaseEnterValidLogin')}`;
}
Onyx.set(key, policyDataWithoutLogin);
});
}

@arosiclair
Copy link
Contributor

I think this command is not using a new API yet:

Yeah this is not supposed to work offline currently. However, the invite button should be blocked while offline to begin with. I was able to repro using v1.1.91-0 and the offline indicator doesn't always appear when I disable Wi-Fi on my macbook:

Screen Shot 2022-08-25 at 1 21 03 PM

@ctkochan22
Copy link
Contributor

Looking at the PR in teh checklist, it could be the case on prod too?

@neil-marcellini
Copy link
Contributor

Since this is not expected to work offline and the only problem is that the invite button is not disabled, it sounds like the core issue is that the offline status is not detected. I'm closing this in favor of #10524.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants