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-03-14] [$500] Workspace - System message for workspace description edit with mark down is not gray #36598

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

Comments

@kbecciv
Copy link

kbecciv commented Feb 15, 2024

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: v1.4.42-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Create a new workspace.
  3. Go to workspace profile.
  4. Click Workspace description.
  5. Save a description without mark down.
  6. Click Workspace description.
  7. Save another description with mark down.
  8. Go to #admin room.

Expected Result:

The system message for workspace description edit should appear gray, regardless of the usage of mark down in the description.

Actual Result:

The system message for workspace description edit is not grayed out when mark down is involved.

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

Bug6380766_1708008538695.bandicam_2024-02-15_16-00-04-569.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01435fd857fbcc98a7
  • Upwork Job ID: 1759631118974234624
  • Last Price Increase: 2024-02-19
  • Automatic offers:
    • hoangzinh | Contributor | 0
@kbecciv kbecciv added the DeployBlockerCash This issue or pull request should block deployment label Feb 15, 2024
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.

Copy link

melvin-bot bot commented Feb 15, 2024

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

@Beamanator
Copy link
Contributor

This is useful to fix, but also doesn't feel like a blocker since everything seems to be working fine (just not a grayed out system message)

@Beamanator Beamanator added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Feb 15, 2024
@bernhardoj
Copy link
Contributor

Proposal

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

The workspace description system message is not grayed out when the description is a markdown.

What is the root cause of that problem?

Currently, we check the action name and apply the gray color.

style={[
_.contains(
[
..._.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG),
CONST.REPORT.ACTIONS.TYPE.IOU,
CONST.REPORT.ACTIONS.TYPE.APPROVED,
CONST.REPORT.ACTIONS.TYPE.MOVED,
],
props.action.actionName,
)
? styles.colorMuted
: undefined,
]}

This works perfectly for a plain text, but not for markdown. When the description is a markdown, it will be rendered as HTML,

if (!differByLineBreaksOnly) {
const editedTag = fragment.isEdited ? `<edited ${styleAsDeleted ? 'deleted' : ''}></edited>` : '';
const htmlContent = styleAsDeleted ? `<del>${html}</del>` : html;
const htmlWithTag = editedTag ? `${htmlContent}${editedTag}` : htmlContent;
return (
<RenderCommentHTML
source={source}
html={htmlWithTag}
/>
);
}

and the style we pass won't work.

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

We can follow the same pattern as styleAsDeleted props. Instead of passing the colorMuted style, we can have a new props called, styleAsMuted with the same condition as below

style={[
_.contains(
[
..._.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG),
CONST.REPORT.ACTIONS.TYPE.IOU,
CONST.REPORT.ACTIONS.TYPE.APPROVED,
CONST.REPORT.ACTIONS.TYPE.MOVED,
],
props.action.actionName,
)

and wrap the HTML with <muted-text> tag to apply the gray text color.

let htmlWithTag = editedTag ? `${htmlContent}${editedTag}` : htmlContent;
if (styleAsMuted) {
    htmlWithTag = `<muted-text>${htmlWithTag}<muted-text>`;
}

Then, for the plain text, we will apply the style if styleAsMuted is true similar to styleAsDeleted to every text that needs it.

styleAsDeleted ? styles.offlineFeedback.deleted : undefined,

Or we can just leave the current style we have to reduce the changes and regression risk. Please let me know which way we should go.

@melvin-bot melvin-bot bot added the Overdue label Feb 19, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

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

@situchan
Copy link
Contributor

As this was deploy blocker, there should be offending PR.
@bernhardoj you know?

@puneetlath
Copy link
Contributor

Making external.

@melvin-bot melvin-bot bot removed the Overdue label Feb 19, 2024
@puneetlath puneetlath added the External Added to denote the issue can be worked on by a contributor label Feb 19, 2024
@melvin-bot melvin-bot bot changed the title Workspace - System message for workspace description edit with mark down is not gray [$500] Workspace - System message for workspace description edit with mark down is not gray Feb 19, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01435fd857fbcc98a7

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 19, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

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

@bernhardoj
Copy link
Contributor

As this was deploy blocker, there should be offending PR.

It's noticeable when the workspace description page is introduced.

@yoyumiracle
Copy link
Contributor

Proposal

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

The system message for workspace description edit is not grayed out when mark down is involved.

What is the root cause of that problem?

function updateWorkspaceDescription(policyID: string, description: string, currentDescription: string) {
  if (description === currentDescription) {
      return;
  }
  const parsedDescription = ReportUtils.getParsedComment(description);

I think ReporUtils.getParsedComment make system message to prevent "CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG"

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

Delete code below

const parsedDescription = ReportUtils.getParsedComment(description);

@hoangzinh
Copy link
Contributor

@yoyumiracle thanks for your proposal. I don't think you have found the root cause yet. Also, your solution doesn't work. Please test your solution on your local next time. Btw, your solution would cause a regression bug, where it displays plain text instead of markdown after saving workspace description

Screenshot 2024-02-20 at 22 17 50

@hoangzinh
Copy link
Contributor

@bernhardoj Thanks for your proposal. It looks good to me, the root cause is correct and you provided a working solution.

Then, for the plain text, we will apply the style if styleAsMuted is true similar to styleAsDeleted to every text that needs it.

I prefer this option. But the style from ReportActionItemMessage component is also used here

<View style={[styles.chatItemMessage, style]}>

I think we should test against 4 actions here to ensure it still works with that option. What do you think?

@yoyumiracle
Copy link
Contributor

yoyumiracle commented Feb 21, 2024

@hoangzinh I'm on your side.
In my opinion when we use markdown the style.colorMuted seems to be not applied to component.
I made mistake that it would be ReactUtils.getParsedComment affect to actions(4 actions) you mentioned.
And I suggest you to check this code, I think htmlWithTag in TextComponentFragment.tsx always has <muted-text> tag by this code.

function getMemberChangeMessageFragment(reportAction: OnyxEntry<ReportAction>): Message {
const messageElements: readonly MemberChangeMessageElement[] = getMemberChangeMessageElements(reportAction);
const html = messageElements
.map((messageElement) => {
switch (messageElement.kind) {
case 'userMention':
return `<mention-user accountID=${messageElement.accountID}>${messageElement.content}</mention-user>`;
case 'roomReference':
return `<a href="${environmentURL}/r/${messageElement.roomID}" target="_blank">${messageElement.roomName}</a>`;
default:
return messageElement.content;
}
})
.join('');
return {
html: `<muted-text>${html}</muted-text>`,
text: reportAction?.message ? reportAction?.message[0].text : '',
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
};
}

Sorry for confusing.

@bernhardoj
Copy link
Contributor

But the style from ReportActionItemMessage component is also used here

I honestly think that the style shouldn't be put there as it affects flagged content text. For our case, we can't flag the 4 actions, so I'm thinking that we should put the styleAsMuted deeper in here

return (
<TextCommentFragment
source={source}
fragment={fragment}
styleAsDeleted={!!(isOffline && isPendingDelete)}
iouMessage={iouMessage}
displayAsGroup={displayAsGroup}
style={style}
/>

I think we should test against 4 actions here to ensure it still works with that option. What do you think?

And yes, we can test this.

@hoangzinh
Copy link
Contributor

@yoyumiracle It won't because this condition is not true in this case

if (ReportActionsUtils.isMemberChangeAction(action)) {

@hoangzinh
Copy link
Contributor

@bernhardoj proposal #36598 (comment) looks good to me. He pointed out the root cause and provided a working solution.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Feb 22, 2024

Current assignee @puneetlath is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 22, 2024
Copy link

melvin-bot bot commented Feb 22, 2024

📣 @hoangzinh 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@bernhardoj
Copy link
Contributor

PR is ready

cc: @hoangzinh

FYI, I haven't got the auto offer yet

cc: @puneetlath

@puneetlath
Copy link
Contributor

Hm, weird that it didn't work sending you the auto-offer. If it doesn't do it, I'll send you one manually when it's time to pay.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 7, 2024
@melvin-bot melvin-bot bot changed the title [$500] Workspace - System message for workspace description edit with mark down is not gray [HOLD for payment 2024-03-14] [$500] Workspace - System message for workspace description edit with mark down is not gray Mar 7, 2024
Copy link

melvin-bot bot commented Mar 7, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 7, 2024
Copy link

melvin-bot bot commented Mar 7, 2024

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

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

@puneetlath
Copy link
Contributor

@puneetlath
Copy link
Contributor

All paid. Thanks y'all!

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 Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants