Skip to content

[Due for payment 2025-08-13] [$250] Import Contacts - Unable to find imported contacts in Start Chat #65916

Closed

Description

@mitarachim

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.1.79-8
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/6442417&group_by=cases:section_id&group_id=306202&group_order=asc
Email or phone of affected tester (no customers): ndk.2303+2303@gmail.com
Issue reported by: Applause Internal Team
Device used: iPhone 11/iOS 18.5
App Component: Other

Action Performed:

Preconditions

  • Clean installation of the app on an iOS device
  • Contact permissions have been granted to the Expensify app
  • Contacts are successfully imported and visible in the app (Check with FAB -> Create Expense -> Scan)
  1. Open the app
  2. Tap on FAB
  3. Tap on Create expense > add any amount and tap on Next
  4. Note that imported contacts are displayed correctly in recipient list
  5. Go to LHN
  6. Tap on FAB
  7. Tap on Start Chat
  8. Note that the imported contacts are not displayed correctly, try searching for any contact from the imported contacts from the device.

Expected Result:

The search accurately finds the contact

Actual Result:

The search can not finds the contacts which are imported from device, although they can be loaded in 'Create Expense' function.

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

Bug6884291_1752209224036.Unable_To_Find_Contacts_Imported_By_Device_In_Start_Chat.mp4
ScreenRecording_07-11-2025.13-45-20_1.MP4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021944119156196629279
  • Upwork Job ID: 1944119156196629279
  • Last Price Increase: 2025-07-19
Issue OwnerCurrent Issue Owner: @Christinadobrzyn

Activity

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

    @melvin-bot

    Triggered auto assignment to @Christinadobrzyn (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 Jul 11, 2025

    @Eskalifer1
    Contributor

    Proposal

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

    Import Contacts - Unable to find imported contacts in Start Chat

    What is the root cause of that problem?

    We currently do not have logic for contacts on the new Chat page

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

    We need to modify the useOptions hook on the newChat page:

    function useOptions() {
    const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState('');
    const [selectedOptions, setSelectedOptions] = useState<SelectedOption[]>([]);
    const [betas] = useOnyx(ONYXKEYS.BETAS, {canBeMissing: true});
    const [newGroupDraft] = useOnyx(ONYXKEYS.NEW_GROUP_CHAT_DRAFT, {canBeMissing: true});
    const personalData = useCurrentUserPersonalDetails();
    const {didScreenTransitionEnd} = useScreenWrapperTransitionStatus();
    const {options: listOptions, areOptionsInitialized} = useOptionsList({
    shouldInitialize: didScreenTransitionEnd,
    });
    const defaultOptions = useMemo(() => {
    const filteredOptions = getValidOptions(
    {
    reports: listOptions.reports ?? [],
    personalDetails: listOptions.personalDetails ?? [],
    },
    {
    betas: betas ?? [],
    selectedOptions,
    includeSelfDM: true,
    },
    );
    return filteredOptions;
    }, [betas, listOptions.personalDetails, listOptions.reports, selectedOptions]);
    const options = useMemo(() => {
    const filteredOptions = filterAndOrderOptions(defaultOptions, debouncedSearchTerm, {
    selectedOptions,
    maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW,
    });
    return filteredOptions;
    }, [debouncedSearchTerm, defaultOptions, selectedOptions]);
    const cleanSearchTerm = useMemo(() => debouncedSearchTerm.trim().toLowerCase(), [debouncedSearchTerm]);
    const headerMessage = useMemo(() => {
    return getHeaderMessage(
    options.personalDetails.length + options.recentReports.length !== 0,
    !!options.userToInvite,
    debouncedSearchTerm.trim(),
    selectedOptions.some((participant) => getPersonalDetailSearchTerms(participant).join(' ').toLowerCase?.().includes(cleanSearchTerm)),
    );
    }, [cleanSearchTerm, debouncedSearchTerm, options.personalDetails.length, options.recentReports.length, options.userToInvite, selectedOptions]);
    useEffect(() => {
    if (!debouncedSearchTerm.length) {
    return;
    }
    searchInServer(debouncedSearchTerm);
    }, [debouncedSearchTerm]);
    useEffect(() => {
    if (!newGroupDraft?.participants) {
    return;
    }
    const newSelectedOptions: OptionData[] = [];
    newGroupDraft.participants.forEach((participant) => {
    if (participant.accountID === personalData.accountID) {
    return;
    }
    let participantOption: OptionData | undefined | null = listOptions.personalDetails.find((option) => option.accountID === participant.accountID);
    if (!participantOption) {
    participantOption = getUserToInviteOption({
    searchValue: participant?.login,
    });
    }
    if (!participantOption) {
    return;
    }
    newSelectedOptions.push({
    ...participantOption,
    isSelected: true,
    });
    });
    setSelectedOptions(newSelectedOptions);
    }, [newGroupDraft?.participants, listOptions.personalDetails, personalData.accountID]);
    return {
    ...options,
    searchTerm,
    debouncedSearchTerm,
    setSearchTerm,
    areOptionsInitialized: areOptionsInitialized && didScreenTransitionEnd,
    selectedOptions,
    setSelectedOptions,
    headerMessage,
    };
    }
    type NewChatPageRef = {
    focus?: () => void;
    };

    Add a state for constacts and their setting:

        const [contactPermissionState, setContactPermissionState] = useState<PermissionStatus>(RESULTS.UNAVAILABLE);
        const [contacts, setContacts] = useState<Array<SearchOption<PersonalDetails>>>([]);
        const importAndSaveContacts = useCallback(() => {
            contactImport().then(({contactList, permissionStatus}: ContactImportResult) => {
                setContactPermissionState(permissionStatus);
                const usersFromContact = getContacts(contactList);
                setContacts(usersFromContact);
            });
        }, []);
        useContactPermissions({
            importAndSaveContacts,
            setContacts,
            contactPermissionState,
            setContactPermissionState,
        });

    Then add them to defaultOptions:

    const defaultOptions = useMemo(() => {
            const filteredOptions = getValidOptions(
                {
                    reports: listOptions.reports ?? [],
                    personalDetails: (listOptions.personalDetails ?? []).concat(contacts),
                },
                {
                    betas: betas ?? [],
                    selectedOptions,
                    includeSelfDM: true,
                },
            );
            return filteredOptions;
        }, [betas, listOptions.personalDetails, listOptions.reports, selectedOptions]);

    We can move this logic to separe hook and use on other pages

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    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. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 12, 2025
  5. changed the title [-]Import Contacts - Unable to find imported contacts in Start Chat[/-] [+][$250] Import Contacts - Unable to find imported contacts in Start Chat[/+] on Jul 12, 2025
  6. melvin-bot commented on Jul 12, 2025

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 12, 2025
  8. melvin-bot commented on Jul 12, 2025

    @melvin-bot

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

  9. aybanda commented on Jul 13, 2025

    @aybanda

    Proposal

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

    Users can't find their phone contacts when starting a new chat. The "Start Chat" page only shows people from the server, but not contacts from their phone's contact list.

    What is the root cause of that problem?

    The NewChatPage doesn't connect to the user's phone contacts. While the app has contact import features that work in other places (like when adding people to expense reports), this feature isn't enabled on the Start Chat page. The existing contact system (contactImport, getContacts, useContactPermissions) works in MoneyRequestParticipantsSelector but isn't integrated into the NewChatPage.

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

    1. Add contact import to the Start Chat page - Use the existing contact system that already works in other parts of the app
    2. Show an "Import Contacts" button - When users haven't given permission to access their contacts
    3. Ask for permission - Show a popup asking users if they want to share their contacts
    4. Display imported contacts - Show phone contacts alongside existing contacts in the search results

    Technical implementation:

    • Extend the useOptions hook in NewChatPage to include contact management
    • Add ContactPermissionModal for permission handling
    • Modify the defaultOptions to include device contacts with server contacts
    • Add "Import Contacts" button to footer when permission not granted

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    Basic Tests:

    • Test that the "Import Contacts" button appears when needed
    • Test that contacts show up in search results after import
    • Test that the permission popup works correctly
    • Test that imported contacts can be selected for chat

    Edge Cases:

    • Test what happens when user denies contact permission
    • Test with empty contact list
    • Test with very large contact lists
    • Test on both iOS and Android
    • Test that imported contacts don't duplicate existing server contacts

    What alternative solutions did you explore? (Optional)

    • Server-side contact sync: Too complex and privacy concerns
    • Separate contacts tab: Would make the interface confusing
    • Manual contact entry: Doesn't solve the problem of finding existing contacts

    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.

  10. melvin-bot commented on Jul 13, 2025

    @melvin-bot

    📣 @aybanda! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  11. aybanda commented on Jul 13, 2025

    @aybanda

    Contributor details
    Your Expensify account email: jsaj2024@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0128101ae814719134

  12. 37 remaining items

  13. melvin-bot commented on Aug 6, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.89-21 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 2025-08-13. 🎊

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

  14. melvin-bot commented on Aug 6, 2025

    @melvin-bot

    @jayeshmangwani @Christinadobrzyn The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  15. Christinadobrzyn commented on Aug 11, 2025

    @Christinadobrzyn
    Contributor

    Payment coming up soon!

  16. jayeshmangwani commented on Aug 13, 2025

    @jayeshmangwani
    Contributor

    @Christinadobrzyn This issue is more of a feature request, as we haven’t implemented imported contacts on the new chat page. Therefore, I’m proposing a regression test instead of the checklist.

  17. jayeshmangwani commented on Aug 13, 2025

    @jayeshmangwani
    Contributor

    Regression Test Proposal

    Preconditions:

    • Contact permissions are granted to the Expensify app.
    • Contacts are successfully imported and visible in the app (verify via FAB -> Create Expense -> Scan).

    Steps:

    1. Open the app on Android or iOS.
    2. Tap on the FAB.
    3. Select Create Expense, enter any amount, and tap Next.
    4. Verify that imported contacts are displayed correctly in the recipient list.
    5. Navigate to LHN.
    6. Tap on the FAB.
    7. Select Start Chat.
    8. Verify that imported contacts are displayed in the Contacts section.

    Do we agree 👍 or 👎

  18. melvin-bot commented on Aug 13, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@Christinadobrzyn)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1944119156196629279/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  19. Eskalifer1 commented on Aug 14, 2025

    @Eskalifer1
    Contributor

    Sorry for the delay, I accepted the offer last night, but because I was sleepy, I forgot to reply.

    cc: @Christinadobrzyn

  20. Christinadobrzyn commented on Aug 14, 2025

    @Christinadobrzyn
    Contributor

    No worries @Eskalifer1! I've paid you through Upwork.

    @jayeshmangwani please make sure to request payment - payment summary is here - #65916 (comment)

    Closing!

  21. twisterdotcom commented on Aug 27, 2025

    @twisterdotcom
    Contributor

    @jayeshmangwani has submitted payment for this report on ND here.

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

    Zapier Logs Run ID: 00040eee-1b03-a856-95e7-8f7026de3431
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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions