Closed IuliiaHerets closed 3 weeks ago
Triggered auto assignment to @mallenexpensify (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.
@mallenexpensify 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
Edited by proposal-police: This proposal was edited at 2024-09-19 12:17:38 UTC.
Task – .com
appears after assignee avatar when create a task manualy
This regex does not handle subdomains in emails correctly
Replace it with this regex:
-const taskRegex = /^\[\]\s+(?:@([^\s@]+(?:@\w+\.\w+)?))?\s*([\s\S]*)/;
+const taskRegex = /^\[\]\s+@([^\s]+)\s*([\s\S]*)/;
https://github.com/user-attachments/assets/e290328a-967d-4b1b-a8e3-8bae0b0305d6
TaskRegex
here is unable to catch such instances of two or more TaskRegex
const taskRegex = /^\[\]\s+(?:@([^\s@]+(?:@\w+(\.\w+)+)?))?\s*([\s\S]*)/;
and
const title = match[3] ? match[3].trim().replace(/\n/g, ' ') : undefined;
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.
.com
appears as the task title when create task from comment.
This happens because the logic can't handle multiple level of domain of an email, for example, @applause.expensifail.com
.
https://github.com/Expensify/App/blob/8d645bfc76bfa1676e0b7730bf6019b4c4161442/src/pages/home/report/ReportFooter.tsx#L132
The regex above, specifically (?:@\w+\.\w+)
only allows (xx.xx) pattern of the domain. This happens after https://github.com/Expensify/App/pull/39475 to allow create task with short domain by making the domain optional, but somehow also changes the rule of the domain which is not needed which also allows the user to mention an email with the last domain with only 1 character, for example, @example.c
. If we use the prev regex, it requires at least 2 character, @example.co
.
Let's use the old regex and make the domain optional.
const taskRegex = /^\[\]\s+(?:@([^\s@]+(?:@[\w.-]+\.[a-zA-Z]{2,})?))?\s*([\s\S]*)/;
I think we can remove -
from the domain regex too.
Job added to Upwork: https://www.upwork.com/jobs/~021836890784466753823
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External
)
Unable to repro on staging, Desktop. @Ollyws can you attempt reproduction plz? Some users have default avatars and some have custom)
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
@mallenexpensify you need to also enter the task title after an email. For example New task
@CyberAndrii and @ChavdaSachin both your proposals will break adding a task without a defined user ([] @ taskname
should create a task)
@bernhardoj's proposal LGTM.
🎀👀🎀 C+ reviewed
Triggered auto assignment to @iwiznia, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
Is the regex supposed to only match [] user@email.com
and [] @someuser
types of texts?
Asking because it also matches things like [] some@thing
which I think is invalid and would break things?
The email regex from MDN matches some@thing
. Maybe we can use that regex and make the domain optional.
^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)?$
// simplified
^[\w.!#$%&'*+/=?^`{|}~-]+(@[a-zA-Z\d](?:[a-zA-Z\d-]{0,61}[a-zA-Z\d])?(?:\.[a-zA-Z\d](?:[a-zA-Z\d-]{0,61}[a-zA-Z\d])?)*)?$
@iwiznia, @Ollyws, @mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Maybe we can use that regex and make the domain optional.
That sounds good to me
PR is ready
cc: @Ollyws
Triggered auto assignment to @NickTooker (Waiting for copy
), see https://stackoverflow.com/c/expensify/questions/7025/ for more details.
Sorry @NickTooker , wrong label :ohnothing:
Contributor: @bernhardoj due $250 via NewDot Contributor+: @Ollyws due $250 via NewDot
@Ollyws plz complete the BZ checklist.
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
Requested in ND.
BugZero Checklist:
- [x] The PR that introduced the bug has been identified. Link to the PR:
https://github.com/Expensify/App/pull/39475
- [x] 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:
https://github.com/Expensify/App/pull/39475/files#r1792852417
- [x] A discussion in #expensify-bugs 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
- [x] Determine if we should create a regression test for this bug.
Yes.
- [x] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Regression Test Proposal
1. Open any chat
2. Enter a task markdown with an assignee with a multi-level domain, for example: [] @example@example.co.id test
3. Verify the task title shown is test, not .id test
Do we agree 👍 or 👎
Requested in ND.
$250 approved for @Ollyws
$250 approved for @bernhardoj
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.0.38-0 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://expensify.testrail.io/index.php?/tests/view/4983838 Email or phone of affected tester (no customers): ponikarchuks+118924@gmail.com Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
.com
not appears after assignee avatarActual Result:
.com
appears after assignee avatarWorkaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/cde0eeb8-e402-499c-8ba9-76b577211b18
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @Ollyws