Skip to content

Contact methods - Set as Default is missing for secondary contacts #76106

Closed

Description

@jponikarchuk

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: v9.2.64-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #73464
Email or phone of affected tester (no customers): applausetester+dp267@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac / Safari
App Component: Search

Action Performed:

Prerequisites: Log in with Expensify account (not Gmail account). Account has several contacts methods added.

  1. Go to Account > Profile > Contact methods
  2. Click main contact
  3. Click secondary contact

Expected Result:

Set as default option should be displayed as it says when clicking main contact

Actual Result:

Set as Default is missing for secondary contacts

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 26, 2025
  2. melvin-bot commented on Nov 26, 2025

    @melvin-bot

    Triggered auto assignment to @trjExpensify (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. Eskalifer1 commented on Nov 26, 2025

    @Eskalifer1
    Contributor

    Proposal

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

    Contact methods - Set as Default is missing for secondary contacts

    What is the root cause of that problem?

    I cannot accurately identify RCA because I do not have access to applause accounts, and it is impossible to use a one-time login for them. But I suspect that the problem here may be that we always display this text for the default method:

    <Text style={[themeStyles.ph5, themeStyles.mv3]}>{translate('contacts.yourDefaultContactMethod')}</Text>

    yourDefaultContactMethod: "This is your current default contact method. Before you can delete it, you'll need to choose another contact method and click “Set as default”.",

    Applause accounts can have a securityGroup with enableRestrictedPrimaryLogin. Here is the final check we use to determine whether a contact method can be set as the default:

    // Allow user to change their default contact method if they don't have a security group OR if their security group
    // does NOT restrict primary login switching.
    return !securityGroups?.[`${ONYXKEYS.COLLECTION.SECURITY_GROUP}${primaryDomainSecurityGroupID}`]?.enableRestrictedPrimaryLogin;

    Here is the entire check for context:

    /**
    * Checks if the user is allowed to change their default contact method. This should only be allowed if:
    * 1. The viewed contact method is not already their default contact method
    * 2. The viewed contact method is validated
    * 3. If the user is on a private domain, their security group must allow primary login switching
    */
    const canChangeDefaultContactMethod = useMemo(() => {
    // Cannot set this contact method as default if:
    // 1. This contact method is already their default
    // 2. This contact method is not validated
    if (isDefaultContactMethod || !loginData?.validatedDate) {
    return false;
    }
    const domainName = Str.extractEmailDomain(session?.email ?? '');
    const primaryDomainSecurityGroupID = myDomainSecurityGroups?.[domainName];
    // If there's no security group associated with the user for the primary domain,
    // default to allowing the user to change their default contact method.
    if (!primaryDomainSecurityGroupID) {
    return true;
    }
    // Allow user to change their default contact method if they don't have a security group OR if their security group
    // does NOT restrict primary login switching.
    return !securityGroups?.[`${ONYXKEYS.COLLECTION.SECURITY_GROUP}${primaryDomainSecurityGroupID}`]?.enableRestrictedPrimaryLogin;
    }, [isDefaultContactMethod, loginData?.validatedDate, session?.email, myDomainSecurityGroups, securityGroups]);

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

    We can change the text and display different translations (or one dynamically) depending on the value of

    securityGroups?.[`${ONYXKEYS.COLLECTION.SECURITY_GROUP}${primaryDomainSecurityGroupID}`]?.enableRestrictedPrimaryLogin
    • if the value is false, display what is currently displayed; if true, we can add text indicating that it is not possible to change the primary email on this private domain.

    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.

  4. trjExpensify commented on Nov 26, 2025

    @trjExpensify
    Contributor

    Not a bug, they have the security group restriction in place, which prevents changing the default contact method:

    Image

    @jponikarchuk please make the team aware. Thanks!

  5. jponikarchuk commented on Nov 26, 2025

    @jponikarchuk
    Author

    @trjExpensify Thank you!

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.ReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions