Skip to content

[Due for payment 2025-11-17] [$250] Expense - Self DM does not show up in the result when searched by display name #71789

Closed

Description

@lanitochka17

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.2.22-4
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://test-management.browserstack.com/projects/2219752/test-runs/TR-1121/folder/13177049/41237808/929687684
Email or phone of affected tester (no customers): sdiojnosdijosiji@gmail.com
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • Account has self DM and display name
  1. Go to staging.new.expensify.com
  2. Open FAB > Create expense > Manual
  3. Enter amount > Next
  4. On recipient list, enter your display name
  5. Clear display name and enter You

Expected Result:

Self DM will show up in the result when searched by display name

Actual Result:

Self DM does not show up in the result when searched by display name, but it shows up when searched by "You" instead

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6962993_1759420830350.Screen_Recording_2025-10-02_at_23.56.50.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021974193357180862799
  • Upwork Job ID: 1974193357180862799
  • Last Price Increase: 2025-10-03
  • Automatic offers:
    • nkdengineer | Contributor | 109042958
Issue OwnerCurrent Issue Owner: @youssef-lr

Activity

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

    @melvin-bot

    Triggered auto assignment to @lschurr (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. nkdengineer commented on Oct 2, 2025

    @nkdengineer
    Contributor

    Proposal

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

    Self DM does not show up in the result when searched by display name, but it shows up when searched by "You" instead

    What is the root cause of that problem?

    The values array isn't lowercase before matching, and the selfDM result isn't matched

    function filterSelfDMChat(report: SearchOptionData, searchTerms: string[]): SearchOptionData | undefined {
    const isMatch = searchTerms.every((term) => {
    const values: string[] = [];
    if (report.text) {
    values.push(report.text);
    }
    if (report.login) {
    values.push(report.login);
    values.push(report.login.replace(CONST.EMAIL_SEARCH_REGEX, ''));
    }
    if (report.isThread) {
    if (report.alternateText) {
    values.push(report.alternateText);
    }
    } else if (!!report.isChatRoom || !!report.isPolicyExpenseChat) {
    if (report.subtitle) {
    values.push(report.subtitle);
    }
    }
    // Remove duplicate values and check if the term matches any value
    return uniqFast(values).some((value) => value.includes(term));

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

    We should convert to a lowercase string before matching

    return uniqFast(values).map((val) => val.toLocaleLowerCase()).some((value) => value.includes(term));
    

    function filterSelfDMChat(report: SearchOptionData, searchTerms: string[]): SearchOptionData | undefined {
    const isMatch = searchTerms.every((term) => {
    const values: string[] = [];
    if (report.text) {
    values.push(report.text);
    }
    if (report.login) {
    values.push(report.login);
    values.push(report.login.replace(CONST.EMAIL_SEARCH_REGEX, ''));
    }
    if (report.isThread) {
    if (report.alternateText) {
    values.push(report.alternateText);
    }
    } else if (!!report.isChatRoom || !!report.isPolicyExpenseChat) {
    if (report.subtitle) {
    values.push(report.subtitle);
    }
    }
    // Remove duplicate values and check if the term matches any value
    return uniqFast(values).some((value) => value.includes(term));

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

    Update filterSelfDMChat unit test to verify the result matches when the display name containsan uppercase character.

    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. nyomanjyotisa commented on Oct 2, 2025

    @nyomanjyotisa
    Member

    Proposal

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

    Expense - Self DM does not show up in the result when searched by display name

    What is the root cause of that problem?

    When a user searches for their display name, the search term is converted to lowercase and split into terms. However, filterSelfDMChat compares these lowercase search terms against the original-cased values from report.text without normalizing or lowercasing them first

    function filterSelfDMChat(report: SearchOptionData, searchTerms: string[]): SearchOptionData | undefined {
    const isMatch = searchTerms.every((term) => {
    const values: string[] = [];
    if (report.text) {
    values.push(report.text);
    }
    if (report.login) {
    values.push(report.login);
    values.push(report.login.replace(CONST.EMAIL_SEARCH_REGEX, ''));
    }
    if (report.isThread) {
    if (report.alternateText) {
    values.push(report.alternateText);
    }
    } else if (!!report.isChatRoom || !!report.isPolicyExpenseChat) {
    if (report.subtitle) {
    values.push(report.subtitle);
    }
    }
    // Remove duplicate values and check if the term matches any value
    return uniqFast(values).some((value) => value.includes(term));
    });
    return isMatch ? report : undefined;
    }

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

    Normalize and lowercase the values before comparison like filterReports function

    function filterSelfDMChat(report: SearchOptionData, searchTerms: string[]): SearchOptionData | undefined {
        const normalizedSearchTerms = searchTerms.map((term) => StringUtils.normalizeAccents(term));
    
        const isMatch = normalizedSearchTerms.every((term) => {
            const values: string[] = [];
    
            if (report.text) {
                values.push(StringUtils.normalizeAccents(report.text).toLowerCase());
            }
            if (report.login) {
                values.push(StringUtils.normalizeAccents(report.login).toLowerCase());
                values.push(StringUtils.normalizeAccents(report.login.replace(CONST.EMAIL_SEARCH_REGEX, '')).toLowerCase());
            }
            if (report.isThread) {
                if (report.alternateText) {
                    values.push(StringUtils.normalizeAccents(report.alternateText).toLowerCase());
                }
            } else if (!!report.isChatRoom || !!report.isPolicyExpenseChat) {
                if (report.subtitle) {
                    values.push(StringUtils.normalizeAccents(report.subtitle).toLowerCase());
                }
            }
    
            // Remove duplicate values and check if the term matches any value
            return uniqFast(values).some((value) => value.includes(term));
        });
    
        return isMatch ? report : undefined;
    }

    function filterSelfDMChat(report: SearchOptionData, searchTerms: string[]): SearchOptionData | undefined {
    const isMatch = searchTerms.every((term) => {
    const values: string[] = [];
    if (report.text) {
    values.push(report.text);
    }
    if (report.login) {
    values.push(report.login);
    values.push(report.login.replace(CONST.EMAIL_SEARCH_REGEX, ''));
    }
    if (report.isThread) {
    if (report.alternateText) {
    values.push(report.alternateText);
    }
    } else if (!!report.isChatRoom || !!report.isPolicyExpenseChat) {
    if (report.subtitle) {
    values.push(report.subtitle);
    }
    }
    // Remove duplicate values and check if the term matches any value
    return uniqFast(values).some((value) => value.includes(term));
    });
    return isMatch ? report : undefined;
    }

    What alternative solutions did you explore? (Optional)

    None

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 3, 2025
  6. changed the title [-]Expense - Self DM does not show up in the result when searched by display name[/-] [+][$250] Expense - Self DM does not show up in the result when searched by display name[/+] on Oct 3, 2025
  7. melvin-bot commented on Oct 3, 2025

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

    @melvin-bot

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

  10. allroundexperts commented on Oct 3, 2025

    @allroundexperts
    Contributor

    @nkdengineer's proposal looks good to me.

    @nyomanjyotisa Thanks for the proposal. I think it has the same RCA and the solution is not very different as well.

    🎀 👀 🎀 C+ reviewed

  11. melvin-bot commented on Oct 3, 2025

    @melvin-bot

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

  12. 19 remaining items

  13. allroundexperts commented on Nov 12, 2025

    @allroundexperts
    Contributor

    BugZero Checklist:

    • [Contributor] 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: This was an edge case that wasn't considered during any implementation PR. As such, there isn't a single culprit PR.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    • Account has self DM and display name

    Test:

    1. Open FAB -> Create expense > Manual
    2. Enter amount -> Next
    3. On recipient list, enter your display name
    4. Clear display name and enter You

    Verify that self DM will show up in the result when searched by display name

    Do we agree 👍 or 👎

  14. melvin-bot commented on Nov 27, 2025

    @melvin-bot

    @youssef-lr 10 days overdue. Is anyone even seeing these? Hello?

  15. youssef-lr commented on Dec 2, 2025

    @youssef-lr
    Contributor

    Not overdue

  16. melvin-bot commented on Dec 5, 2025

    @melvin-bot

    @youssef-lr Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  17. youssef-lr commented on Dec 9, 2025

    @youssef-lr
    Contributor

    @lschurr can you check the last task from here please

  18. lschurr commented on Dec 10, 2025

    @lschurr
    Contributor

    Payment Summary

    Contributor: @nkdengineer due $250 via NewDot
    Contributor+: @allroundexperts due $250 via NewDot

  19. trjExpensify commented on Jan 5, 2026

    @trjExpensify
    Contributor

    approved $250 for @allroundexperts.

  20. twisterdotcom commented on Mar 11, 2026

    @twisterdotcom
    Contributor

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

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

    Zapier Logs Run ID: 00040eee-5e98-abe8-8146-c92ff85e3f74
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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions