Skip to content

[Due for payment 2025-03-05] System message for deleted an expense on this report has two spaces before the merchant name #56565

Description

@m-natarajan

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.95-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation (hyperlinked to channel name):

Action Performed:

  1. Submit multiple expenses in a report on a workspace
  2. Delete one of the expense

Expected Result:

The system message for deleted an expense on this report should have only one space before the merchant name, ensuring proper formatting.

Actual Result:

System message for deleted an expense on this report has two spaces before the merchant name

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Image

Image

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @JmillsExpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @JmillsExpensify (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. linhvovan29546 commented on Feb 8, 2025

    @linhvovan29546
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-02-08 02:18:33 UTC.

    Proposal

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

    System message for deleted an expense on this report has two spaces before the merchant name

    What is the root cause of that problem?

    The issue is caused by a duplicate space in the following line:

    deletedTransaction: ({amount, merchant}: DeleteTransactionParams) => `deleted an expense on this report, ${merchant} - ${amount}`,

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

    We need to remove the extra space:

    deletedTransaction: ({amount, merchant}: DeleteTransactionParams) => `deleted an expense on this report, ${merchant} - ${amount}`,

            deletedTransaction: ({amount, merchant}: DeleteTransactionParams) => `deleted an expense on this report, ${merchant} - ${amount}`,

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

    We can write a custom ESLint rule to detect double spaces in en.ts and es.ts for eslint-config-expensify.

    Custom rule example

    We will add the following file to https://github.com/Expensify/eslint-config-expensify/tree/main/eslint-plugin-expensify

    module.exports = {
      meta: {
        type: 'suggestion',
        docs: {
          description: 'Enforce single spaces in template literals and string literals',
          category: 'Stylistic Issues',
          recommended: true,
          fixable: 'code',
        },
        fixable: 'code',
        schema: [],
      },
      create(context) {
        const doubleSpaceRegex = /(?<!\n) {2,}/g;
    
        function checkNode(node) {
          const value = node.value;
    
          if (doubleSpaceRegex.test(value)) {
            context.report({
              node,
              message: 'Multiple spaces found',
            });
          }
        }
    
        return {
          Literal(node) {
            if (typeof node.value === 'string') {
              checkNode(node);
            }
          },
          TemplateLiteral(node) {
            node.quasis.forEach(quasi => {
              const value = quasi.value.raw;
              const doubleSpaceRegex = /(?<!\n) {2,}/g;
              const matches = value.match(doubleSpaceRegex);
              
              if (matches) {
                context.report({
                  node: quasi,
                  message: 'Multiple spaces found',
                });
              }
            });
          },
        };
      },
    };

    Then, in the .eslintrc.js file, we only need to add rulesdir/rule-name-above': 'error' inside the overrides section for files: ['en.ts', 'es.ts']

    Results Image

    What alternative solutions did you explore? (Optional)

    We can use a regex to remove extra spaces

    App/src/libs/ReportUtils.ts

    Lines 5346 to 5350 in 628a915

    const message = translateLocal('iou.deletedTransaction', {
    amount: `${currency}${amount}`,
    merchant: deletedTransactionOriginalMessage.merchant ?? '',
    });
    return message;

    message.replace(CONST.REGEX.WHITESPACE, ' ')

    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. melvin-bot commented on Feb 11, 2025

    @melvin-bot

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

  5. melvin-bot commented on Feb 13, 2025

    @melvin-bot

    @JmillsExpensify Huh... This is 4 days overdue. Who can take care of this?

  6. JmillsExpensify commented on Feb 17, 2025

    @JmillsExpensify
    Contributor

    We need to fix this one on the backend. @deetergp should we add it as cleanup on the improve system messages project?

  7. linhvovan29546 commented on Feb 17, 2025

    @linhvovan29546
    Contributor

    We need to fix this one on the backend. @deetergp should we add it as cleanup on the improve system messages project?

    @JmillsExpensify I see that this is a FE issue, regression from #54175 I think we need to write an ESLint rule to prevent this issue in the future

  8. deetergp commented on Feb 17, 2025

    @deetergp
    Contributor

    @JmillsExpensify The BE for this flow looks correct. As @linhvovan29546 mentioned, it's a FE regression in the PR they linked. The highlighted area in this screen grab is two spaces.
    Image

  9. melvin-bot commented on Feb 20, 2025

    @melvin-bot

    @JmillsExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  10. 12 remaining items

  11. changed the title [-]System message for `deleted an expense on this report` has two spaces before the merchant name[/-] [+][Due for payment 2025-03-05] System message for `deleted an expense on this report` has two spaces before the merchant name[/+] on Feb 26, 2025
  12. melvin-bot commented on Feb 26, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  13. melvin-bot commented on Feb 26, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.6-1 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-03-05. 🎊

  14. melvin-bot commented on Feb 26, 2025

    @melvin-bot

    @deetergp @JmillsExpensify @deetergp 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. brunovjk commented on Feb 26, 2025

    @brunovjk
    Contributor

    I noted on the PR linked PR that it caused this regression

    I believe no payment is necessary here, right @deetergp? Thanks.

  16. deetergp commented on Feb 27, 2025

    @deetergp
    Contributor

    Correct @brunovjk, since it was a regression and was fixed by the original author.

  17. melvin-bot commented on Mar 5, 2025

    @melvin-bot

    Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO.

  18. deetergp commented on Mar 7, 2025

    @deetergp
    Contributor

    This was regression was fixed by the contributor that introduced it. We can just close.

  19. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Mar 7, 2025
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.DailyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions