Closed lanitochka17 closed 3 days ago
Triggered auto assignment to @sakluger (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.
@sakluger 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
Tags - mWeb - Creating expense with tag G : : displays tag no longer valid error
This is because we are removing the last colons here
https://github.com/Expensify/App/blob/3722b22302e5d89f2916d5e8958b2cf17ecb6285/src/libs/IOUUtils.ts#L144-L145
which will create an incompatibility with the tag of the workspace which is G ::
We are removing the last colons to remove empty multilevel tags which are joined by a colon here
https://github.com/Expensify/App/blob/3722b22302e5d89f2916d5e8958b2cf17ecb6285/src/libs/IOUUtils.ts#L144-L145
But we need to make sure that the colons are not preceded by a backslash \
because that would mean the colon is part of the tag name as the backend normally returns colons after escaping with backslashes.
So we need to change it to
return tagArray.join(CONST.COLON).replace(/(?<!\\):*$/, '');
Making this external. Let's be careful to keep in mind that colons are how we store different levels of tags with multi-level tags.
Job added to Upwork: https://www.upwork.com/jobs/~01c81e89645f07ad39
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (External
)
Creating expense with tag G : : displays tag no longer valid error
In https://github.com/Expensify/App/blob/881c5482facc08af709f047025c863ad67b6d5b3/src/libs/IOUUtils.ts#L144, we always remove the last :
, the aim was to remove empty multi-level tags. However in this case the :
is user input and is formatted as \:
by the back-end, but we're wrongly removing the last :
.
We should filter the empty item at the last of tagArray
instead of using Regex here
while (tagArray.length > 0 && !tagArray[tagArray.length - 1]) {
tagArray.pop();
}
return tagArray.join(CONST.COLON);
This will preserve existing last :
removal behavior, but if empty tags should be removed if it's in the middle too, above can be simplified by just using filter
to filter out empty item in tagArray
. We could also trim
the tagArray item before checking its emptyness.
I tried updating the Regex to use look behind like above proposal but it doesn't work for multiple browsers (like older Safari version), reference: https://caniuse.com/js-regexp-lookbehind. Also IMO we should try to avoid using Regex as much as possible because it's hard to read.
2 proposals in review
π£ @webdog12345! π£ 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:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Tag is changed to G: it happens because of this function.(App/src/libs/IOUUtils.ts Line140) function insertTagIntoTransactionTagsString(transactionTags: string, tag: string, tagIndex: number): string { const tagArray = TransactionUtils.getTagArrayFromName(transactionTags); tagArray[tagIndex] = tag;
return tagArray.join(CONST.COLON).replace(/:*$/, '');
}
we can change this function like this function insertTagIntoTransactionTagsString(transactionTags: string, tag: string, tagIndex: number): string { const tagArray = TransactionUtils.getTagArrayFromName(transactionTags); // Update the tag at the specified index tagArray[tagIndex] = tag;
// Use CONST.COLON to join tags and ensure double colons are preserved
return tagArray.join(CONST.COLON.repeat(2)).replace(new RegExp(`${CONST.COLON}{2,}$`), '');
} I have read and understood contributing guidelines. Your Expensify account email: AnsonHelbert0127@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/arturl39
@sakluger, @situchan Eep! 4 days overdue now. Issues have feelings too...
Hey @situchan - it looks like we have a few proposals ready for review.
Agree we should avoid negative lookbehind.
using filter to filter out empty item in tagArray. We could also trim the tagArray item before checking its emptyness.
@daledah's proposal looks good. πππ C+ reviewed
Triggered auto assignment to @Julesssss, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
but if empty tags should be removed if it's in the middle too, above can be simplified by just using filter to filter out empty item in tagArray. We could also trim the tagArray item before checking its emptyness.
π
π£ @situchan π An offer has been automatically sent to your Upwork account for the Reviewer role π Thanks for contributing to the Expensify app!
π£ @daledah You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing π
@daledah @situchan seems like this caused https://github.com/Expensify/App/issues/47631, could you please check while it is still within the regression period?
@paultsimura I'm working on a PR right now.
This issue has not been updated in over 15 days. @sakluger, @Julesssss, @situchan, @daledah eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
β οΈ We just got confirmation on Slack that the Deploy Checklist: New Expensify 2024-08-26 which includes the PR of this issue was only deployed to production today in Deploy Checklist: New Expensify 2024-08-28. More context on why this happened can be found in this Slack thread and this Slack comment.
Given the context above, this issue should be on [HOLD for Payment 2024-09-6] according to today's production deploy from Deploy Checklist: New Expensify 2024-08-28.
We already have regression test - https://expensify.testrail.io/index.php?/tests/view/4784898
Ready for payment @sakluger π
Sorry for the delay - I missed this since it still had the monthly priority label. I'll process payment now.
Summarizing payment on this issue:
Contributor: @daledah $250, please accept the Upwork offer: https://www.upwork.com/nx/wm/offer/104520924 Contributor+: @situchan $250, paid via Upwork
Offer is still pending. We can close as soon as it's accepted and paid.
I haven't seen @daledah in Slack or GH for the past few days, so they may be on leave. I'm going to set this to weekly and check back in a week.
Many thanks @sakluger I have accepted the offer
Thanks @daledah, I've paid out the contract.
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.14 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/4784898 Issue reported by: Applause - Internal Team
Action Performed:
Expected Result:
Creating expense with tag G : : must not display tag no longer valid error
Actual Result:
Creating expense with tag G : : displays tag no longer valid error
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/6b8a0c7d-a311-4135-8c34-aa3b548a0488
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @daledah