Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2024-08-01] [$250] Chat - User mention is not linked and it is not an actual mention when editing message #45435

Closed
6 tasks done
lanitochka17 opened this issue Jul 15, 2024 · 17 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 15, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.7-1
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to chat
  3. Send a message
  4. Right click on the message > Edit comment
  5. Type @
  6. Select a user from the suggestion list
  7. Save the edit

Expected Result:

The user mention is not linked and it will be an actual mention (highlighted)

Actual Result:

The user mention is not linked and it is not an actual mention (not highlighted)

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6543224_1721079056142.20240716_052701.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0161a3b21c19784a1d
  • Upwork Job ID: 1813262786022749752
  • Last Price Increase: 2024-07-16
Issue OwnerCurrent Issue Owner: @allroundexperts
@lanitochka17 lanitochka17 added DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels Jul 15, 2024
Copy link

melvin-bot bot commented Jul 15, 2024

Triggered auto assignment to @jasperhuangg (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@bernhardoj
Copy link
Contributor

Proposal

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

The user mention in short form is not converted to a mention when editing message.

What is the root cause of that problem?

If we add a message, we convert all the short mentions to their long form (with the domain) and set it to the action message and also send it to the AddComment API.

App/src/libs/ReportUtils.ts

Lines 3661 to 3675 in fb9ce79

function getParsedComment(text: string, parsingDetails?: ParsingDetails): string {
let isGroupPolicyReport = false;
if (parsingDetails?.reportID) {
const currentReport = getReportOrDraftReport(parsingDetails?.reportID);
isGroupPolicyReport = isReportInGroupPolicy(currentReport);
}
const textWithMention = text.replace(CONST.REGEX.SHORT_MENTION, (match) => {
if (!Str.isValidMention(match)) {
return match;
}
const mention = match.substring(1);
const mentionWithDomain = addDomainToShortMention(mention);
return mentionWithDomain ? `@${mentionWithDomain}` : match;
});

The mention renderer will then show the short form if found, so ther user will still see the short form in the message list.

However, when editing the message, we don't do any conversion, so the short mention is saved as it is and won't be rendered as a mention.

const htmlForNewComment = handleUserDeletedLinksInHtml(textForNewComment, originalCommentMarkdown, videoAttributeCache);

App/src/libs/actions/Report.ts

Lines 1517 to 1526 in fb9ce79

function handleUserDeletedLinksInHtml(newCommentText: string, originalCommentMarkdown: string, videoAttributeCache?: Record<string, string>): string {
if (newCommentText.length > CONST.MAX_MARKUP_LENGTH) {
return newCommentText;
}
const htmlForNewComment = Parser.replace(newCommentText, {
extras: {videoAttributeCache},
});
const removedLinks = Parser.getRemovedMarkdownLinks(originalCommentMarkdown, newCommentText);
return removeLinksFromHtml(htmlForNewComment, removedLinks);

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

Convert any short mention to a long mention when editing a message too. We can create a new function that does that so it's reusable between add and edit comments.

App/src/libs/ReportUtils.ts

Lines 3668 to 3675 in fb9ce79

const textWithMention = text.replace(CONST.REGEX.SHORT_MENTION, (match) => {
if (!Str.isValidMention(match)) {
return match;
}
const mention = match.substring(1);
const mentionWithDomain = addDomainToShortMention(mention);
return mentionWithDomain ? `@${mentionWithDomain}` : match;
});

@jasperhuangg
Copy link
Contributor

@bernhardoj let me know when you can get started!

@jasperhuangg
Copy link
Contributor

This doesn't exist on prod yet since it's a brand new feature, don't think we need to block deploy on this.

@jasperhuangg jasperhuangg added External Added to denote the issue can be worked on by a contributor Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Jul 16, 2024
@melvin-bot melvin-bot bot changed the title Chat - User mention is not linked and it is not an actual mention when editing message [$250] Chat - User mention is not linked and it is not an actual mention when editing message Jul 16, 2024
Copy link

melvin-bot bot commented Jul 16, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0161a3b21c19784a1d

Copy link

melvin-bot bot commented Jul 16, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 16, 2024
@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jul 16, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Jul 16, 2024
@bernhardoj
Copy link
Contributor

PR is ready

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 25, 2024
@melvin-bot melvin-bot bot changed the title [$250] Chat - User mention is not linked and it is not an actual mention when editing message [HOLD for payment 2024-08-01] [$250] Chat - User mention is not linked and it is not an actual mention when editing message Jul 25, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 25, 2024
Copy link

melvin-bot bot commented Jul 25, 2024

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

Copy link

melvin-bot bot commented Jul 25, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.11-5 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 2024-08-01. 🎊

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

@allroundexperts
Copy link
Contributor

Checklist

  1. This was a new feature and there wasn't any PR that caused it.
  2. N/A
  3. N/A
  4. A regression test would be good here.

Regression test

  1. Open the app and go to any chat
  2. Send a message and right click on the message > Edit comment
  3. Type @ and select a user from the suggestion list
  4. Save the edit and verify that the user mention is not linked and it is an actual mention

Do we 👍 or 👎 ?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 31, 2024
Copy link

melvin-bot bot commented Aug 1, 2024

Issue is ready for payment but no BZ is assigned. @miljakljajic you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

Copy link

melvin-bot bot commented Aug 1, 2024

Payment Summary

Upwork Job

BugZero Checklist (@miljakljajic)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1813262786022749752/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@bernhardoj
Copy link
Contributor

Requested in ND.

@miljakljajic
Copy link
Contributor

@allroundexperts is owed 250 for their work on this issue

@bernhardoj is owed 250 for their work on this issue

@melvin-bot melvin-bot bot added the Overdue label Aug 5, 2024
@melvin-bot melvin-bot bot removed the Overdue label Aug 5, 2024
@JmillsExpensify
Copy link

$250 approved for @bernhardoj

@JmillsExpensify
Copy link

$250 approved for @allroundexperts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants