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 2024-10-24] [$250] Error when copilot adds a new contact method #50063

Closed
2 of 6 tasks
IuliiaHerets opened this issue Oct 2, 2024 · 41 comments
Closed
2 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Oct 2, 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: 9.0.42-3
Reproducible in staging?: Y
Reproducible in production?: Y
Issue was found when executing this PR: #49150
Issue reported by: Applause Internal Team

Action Performed:

  1. Log in the App
  2. Add a copilot to the user A
  3. Login as copilot
  4. Go to Account settings.
  5. Click on the account switcher
  6. Switch to user A account
  7. Click Contact method.
  8. Click New contact method.
  9. Enter a new email address
  10. Click Next

Expected Result:

The new email address is added as a new contact method.

Actual Result:

Copilot can not add new contact method. Error message "An unexpected error occurred when trying to add the new login.". RD in LHN-Profile, Profile window-Contact method, and LHP.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6622066_1727870652691.49150failst.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021842646552595795235
  • Upwork Job ID: 1842646552595795235
  • Last Price Increase: 2024-10-05
  • Automatic offers:
    • c3024 | Reviewer | 104335384
Issue OwnerCurrent Issue Owner: @anmurali
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 2, 2024
Copy link

melvin-bot bot commented Oct 2, 2024

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

@IuliiaHerets
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

@IuliiaHerets
Copy link
Author

@anmurali FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@ChavdaSachin
Copy link
Contributor

ChavdaSachin commented Oct 2, 2024

Edited by proposal-police: This proposal was edited at 2024-10-08 14:47:15 UTC.

Proposal

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

Error when copilot adds a new contact method

What is the root cause of that problem?

  • Copilot does not have enough authorities to add new contact methods.

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

Option 1.

  • Disable New Contact Method button if current user is a copilot.
    const [account] = useOnyx(ONYXKEYS.ACCOUNT);
    const isActingAsDelegate = !!account?.delegatedAccess?.delegate ?? false;
    .
    .
    .
    <Button
        isDisabled = {isActingAsDelegate}
        large
        success
        text={translate('contacts.newContactMethod')}
        onPress={onNewContactMethodButtonPress}
        pressOnEnter
    />

<Button
large
success
text={translate('contacts.newContactMethod')}
onPress={onNewContactMethodButtonPress}
pressOnEnter
/>

optionally we could add a short message above New Contact Method button to inform user that - copilot could not add new contact method.

Option 2.

  • Hide New Contact Method button if current user is copilot.
    const [account] = useOnyx(ONYXKEYS.ACCOUNT);
    const isActingAsDelegate = !!account?.delegatedAccess?.delegate ?? false;
    .
    .
    .
    { !isActingAsDelegate && <Button 
        large
        success
        text={translate('contacts.newContactMethod')}
        onPress={onNewContactMethodButtonPress}
        pressOnEnter
    />}

<Button
large
success
text={translate('contacts.newContactMethod')}
onPress={onNewContactMethodButtonPress}
pressOnEnter
/>

  • In addition to both of the above options - wrap NewContactMethodPage with AccessOrNotFoundWrapper to avoid copilot using deep link to access the page.
    <AccessOrNotFoundWrapper
        shouldBeBlocked = {isActingAsDelegate}
        .
        .
    >
        <ScreenWrapper
        .
        .
        </ScreenWrapper>
     </AccessOrNotFoundWrapper>

<ScreenWrapper
onEntryTransitionEnd={() => loginInputRef.current?.focus()}
includeSafeAreaPaddingBottom={false}
shouldEnableMaxHeight
testID={NewContactMethodPage.displayName}
>
<HeaderWithBackButton
title={translate('contacts.newContactMethod')}
onBackButtonPress={onBackButtonPress}
/>
<FormProvider
formID={ONYXKEYS.FORMS.NEW_CONTACT_METHOD_FORM}
validate={validate}
onSubmit={handleValidateMagicCode}
submitButtonText={translate('common.add')}
style={[styles.flexGrow1, styles.mh5]}
>
<Text style={styles.mb5}>{translate('common.pleaseEnterEmailOrPhoneNumber')}</Text>
<View style={styles.mb6}>
<InputWrapper
InputComponent={TextInput}
label={`${translate('common.email')}/${translate('common.phoneNumber')}`}
aria-label={`${translate('common.email')}/${translate('common.phoneNumber')}`}
role={CONST.ROLE.PRESENTATION}
inputMode={CONST.INPUT_MODE.EMAIL}
ref={loginInputRef}
inputID={INPUT_IDS.PHONE_OR_EMAIL}
autoCapitalize="none"
enterKeyHint="done"
maxLength={CONST.LOGIN_CHARACTER_LIMIT}
/>
</View>
{hasFailedToSendVerificationCode && (
<DotIndicatorMessage
messages={ErrorUtils.getLatestErrorField(pendingContactAction, 'actionVerified')}
type="error"
/>
)}
</FormProvider>
<ValidateCodeActionModal
validatePendingAction={pendingContactAction?.pendingFields?.actionVerified}
validateError={validateLoginError}
handleSubmitForm={addNewContactMethod}
clearError={() => User.clearContactMethodErrors(contactMethod, 'validateLogin')}
onClose={() => setIsValidateCodeActionModalVisible(false)}
isVisible={isValidateCodeActionModalVisible}
title={contactMethod}
description={translate('contacts.enterMagicCode', {contactMethod})}
/>
</ScreenWrapper>

What alternative solutions did you explore? (Optional)

  • add DelegateNoAccessModal to NewContactMethodPage and when user is delegate and press New Contact Method button show DelegateNoAccessModal
  • we need to make few changes to DelegateNoAccessModal as well, since currently it has only prompt for limitedAccessDelegate but for this action here we also restrict fullAccessDelegate so we have too add prompt support for fullAccessDelegate

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.

@melvin-bot melvin-bot bot added the Overdue label Oct 4, 2024
@anmurali anmurali added the External Added to denote the issue can be worked on by a contributor label Oct 5, 2024
@melvin-bot melvin-bot bot changed the title Error when copilot adds a new contact method [$250] Error when copilot adds a new contact method Oct 5, 2024
Copy link

melvin-bot bot commented Oct 5, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 5, 2024
Copy link

melvin-bot bot commented Oct 5, 2024

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

@c3024
Copy link
Contributor

c3024 commented Oct 6, 2024

Thanks for the proposal @ChavdaSachin.

@Expensify/design

Should we hide the "New Contact Method" button altogether or disable the button with a message on hover when a copilot accesses the account they are delegated to?

@dubielzyk-expensify
Copy link
Contributor

Hmm. We tend to not do disabling or hiding in this kind of situation, but I also think the error is enough. Keen to hear if @dannymcclain agrees.

@dannymcclain
Copy link
Contributor

I do agree. And if the problem is that the copilot isn't authorized to take that action, we already have a pattern for handling that:
CleanShot 2024-10-08 at 09 10 35@2x

I realize that the above is showing a restricted action because the copilot is set to Limited, but I think the same pattern can easily apply here if permissions are the issue. We could just update the copy of the modal to be something like:

Not so fast...
You don't have permission to take this action for {{user}} as a copilot.

I'm imagining this modal would pop up when the copilot clicks the New contact method button. Thoughts?

@melvin-bot melvin-bot bot added the Overdue label Oct 8, 2024
@ChavdaSachin
Copy link
Contributor

Updated Proposal
added @dannymcclain 's suggestion as alternate solution.

@dubielzyk-expensify
Copy link
Contributor

Love that @dannymcclain !

@anmurali
Copy link

anmurali commented Oct 9, 2024

@c3024 - can you please review @ChavdaSachin revised proposal?

@anmurali anmurali added Daily KSv2 and removed Daily KSv2 Overdue labels Oct 9, 2024
@c3024
Copy link
Contributor

c3024 commented Oct 9, 2024

@ChavdaSachin’s alternative solution, as per design inputs, looks good to me. We can work on more specifics in the PR with reviews from the design team.

🎀 👀 🎀 C+ reviewed.

Copy link

melvin-bot bot commented Oct 9, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 17, 2024
Copy link

melvin-bot bot commented Oct 17, 2024

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

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

Copy link

melvin-bot bot commented Oct 17, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR:
  • [@c3024] 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:
  • [@c3024] 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:
  • [@c3024] Determine if we should create a regression test for this bug.
  • [@c3024] 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.
  • [@anmurali] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@c3024
Copy link
Contributor

c3024 commented Oct 25, 2024

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:

  • [@c3024] The PR that introduced the bug has been identified. Link to the PR: The frontend part was not implemented for this yet. So, no PR can be held responsible for this.
  • [@c3024] 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: NA
  • [@c3024] 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: No discussion was started because this could not have been identified earlier.
  • [@c3024] Determine if we should create a regression test for this bug. Yes
  • [@c3024] 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.

Regression Test Proposal

  1. Navigate to "Settings" > "Profile" as a copilot.
  2. Click on 'Contact methods'.
  3. Click on 'New contact method' button.
  4. Verify 'Not So Fast...' modal appears and 'New contact method' flow does not start.

@melvin-bot melvin-bot bot added the Overdue label Oct 25, 2024
Copy link

melvin-bot bot commented Oct 28, 2024

@Julesssss, @anmurali, @ChavdaSachin, @c3024 Huh... This is 4 days overdue. Who can take care of this?

@Julesssss
Copy link
Contributor

Awaiting payment

@anmurali
Copy link

@ChavdaSachin - can you please give me your Upwork profile? You are in Slack, yes?
@c3024 is paid.

@melvin-bot melvin-bot bot removed the Overdue label Oct 29, 2024
@ChavdaSachin
Copy link
Contributor

ChavdaSachin commented Oct 30, 2024

I am not on slack yet.
https://www.upwork.com/freelancers/~016a0f0a12bce54a49

I have already applied for the job on upwork.

@anmurali

@ChavdaSachin
Copy link
Contributor

@anmurali can you get it done today?
That would be helpful.

@melvin-bot melvin-bot bot added the Overdue label Nov 1, 2024
Copy link

melvin-bot bot commented Nov 4, 2024

@Julesssss, @anmurali, @ChavdaSachin, @c3024 Eep! 4 days overdue now. Issues have feelings too...

@anmurali
Copy link

anmurali commented Nov 6, 2024

Offer is here

@melvin-bot melvin-bot bot removed the Overdue label Nov 6, 2024
@ChavdaSachin
Copy link
Contributor

Accepted

@ChavdaSachin
Copy link
Contributor

friendly bump ^ @anmurali

@melvin-bot melvin-bot bot added the Overdue label Nov 11, 2024
Copy link

melvin-bot bot commented Nov 11, 2024

@Julesssss, @anmurali, @ChavdaSachin, @c3024 Eep! 4 days overdue now. Issues have feelings too...

@github-project-automation github-project-automation bot moved this from Hold for Payment to Done in [#whatsnext] #expense Nov 12, 2024
@melvin-bot melvin-bot bot removed the Overdue label Nov 12, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 21, 2024
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. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Archived in project
Development

No branches or pull requests

7 participants