Skip to content

[HOLD for payment 2024-10-24] [$250] Error when copilot adds a new contact method #50063

Closed

Description

@IuliiaHerets

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 2, 2024
  2. melvin-bot commented on Oct 2, 2024

    @melvin-bot

    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.

  3. IuliiaHerets commented on Oct 2, 2024

    @IuliiaHerets
    Author

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

  4. IuliiaHerets commented on Oct 2, 2024

    @IuliiaHerets
    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

  5. ChavdaSachin commented on Oct 2, 2024

    @ChavdaSachin
    Contributor

    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.

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 5, 2024
  7. changed the title [-]Error when copilot adds a new contact method[/-] [+][$250] Error when copilot adds a new contact method[/+] on Oct 5, 2024
  8. melvin-bot commented on Oct 5, 2024

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Oct 5, 2024
  10. melvin-bot commented on Oct 5, 2024

    @melvin-bot

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

  11. 50 remaining items

  12. ChavdaSachin commented on Oct 30, 2024

    @ChavdaSachin
    Contributor

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

  13. melvin-bot commented on Nov 4, 2024

    @melvin-bot

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

  14. anmurali commented on Nov 6, 2024

    @anmurali

    Offer is here

  15. ChavdaSachin commented on Nov 6, 2024

    @ChavdaSachin
    Contributor

    Accepted

  16. ChavdaSachin commented on Nov 7, 2024

    @ChavdaSachin
    Contributor

    friendly bump ^ @anmurali

  17. melvin-bot commented on Nov 11, 2024

    @melvin-bot

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

  18. moved this from Hold for Payment to Done in #expensify-bugson Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions