Skip to content

[Due for payment 2025-05-14] [$250] Admin - Workspace description with markdown is shown as html tags in admin room system message. #59435

Closed

Description

@jponikarchuk

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 1.21-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: N
Email or phone of affected tester (no customers): Slottwo1 aya@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13
App Component: Workspace Settings

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Tap settings - workspaces - create a new workspace
  3. Tap overview - description
  4. Change description as 5 & save
  5. Go to admin room

Expected Result:

Workspace description with markdown must not be shown as html tags in admin room system message.

Actual Result:

Workspace description with markdown is shown as html tags in admin room system message.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6784750_1743110346795.Dvnb8264_1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021910766257068312583
  • Upwork Job ID: 1910766257068312583
  • Last Price Increase: 2025-04-25
Issue OwnerCurrent Issue Owner: @adelekennedy

Activity

  1. added
    Bug
    Daily
    on Apr 1, 2025
  2. melvin-bot commented on Apr 1, 2025

    @melvin-bot

    Triggered auto assignment to @adelekennedy (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. nkdengineer commented on Apr 1, 2025

    @nkdengineer
    Contributor

    Proposal

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

    Workspace description with markdown is shown as html tags in admin room system message.

    What is the root cause of that problem?

    We don't convert the newDescription/oldDescription to text when we get the workspace update description message here then, the description still contains markdown.

    children = <ReportActionItemBasicMessage message={getWorkspaceDescriptionUpdatedMessage(action)} />;

    typeof oldDescription === 'string' && newDescription ? translateLocal('workspaceActions.updateWorkspaceDescription', {newDescription, oldDescription}) : getReportActionText(action);

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

    We should convert the description to text and use this to display the message

    const oldDescriptionText = getTextFromHtml(oldDescription);
    const newDescriptionText = getTextFromHtml(newDescription);
    const message =
        typeof oldDescriptionText === 'string' && newDescriptionText ? translateLocal('workspaceActions.updateWorkspaceDescription', {newDescription: newDescriptionText, oldDescription: oldDescriptionText}) : getReportActionText(action);
    return message;
    

    children = <ReportActionItemBasicMessage message={getWorkspaceDescriptionUpdatedMessage(action)} />;

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

    None

    What alternative solutions did you explore? (Optional)

    If we want to display the message with markdown style, we can remove this case here

    } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DESCRIPTION) {
    children = <ReportActionItemBasicMessage message={getWorkspaceDescriptionUpdatedMessage(action)} />;
    } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_CURRENCY) {

    And create a util to get the workspace description fragment like we did for the update room description action here

    if (action.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION) {
    const fragment = getUpdateRoomDescriptionFragment(action);
    return (
    <View style={[styles.chatItemMessage, style]}>
    <TextCommentFragment
    fragment={fragment}
    displayAsGroup={displayAsGroup}

    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. samranahm commented on Apr 1, 2025

    @samranahm
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-04-01 12:28:12 UTC.

    Proposal

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

    Workspace description with markdown is shown as html tags in admin room system message.

    What is the root cause of that problem?

    Here

    const {oldDescription, newDescription} = getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DESCRIPTION>) ?? {};

    We are not converting HTML we get from getOriginalMessage to text before displaying in system message in #admin room

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

    We should explicitly convert HTML to text using Parser.htmlToText like we doing at multiple locations

    const {oldDescription, newDescription} = getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DESCRIPTION>) ?? {};
    const oldDescriptionText = Parser.htmlToText(oldDescription ?? '');
    const newDescriptionText = Parser.htmlToText(newDescription ?? '');
    const message =
      typeof oldDescriptionText === 'string' && newDescriptionText ? translateLocal('workspaceActions.updateWorkspaceDescription', {newDescriptionText, oldDescriptionText}) : getReportActionText(action);
    return message;

    and update UpdatedPolicyDescriptionParams

    type UpdatedPolicyDescriptionParams = {oldDescription: string; newDescription: string};

    to

    type UpdatedPolicyDescriptionParams = {oldDescriptionText: string; newDescriptionText: string};

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

    N/A

    What alternative solutions did you explore? (Optional)

    We can also reflector our getOriginalMessage to always return text since we mostly use getOriginalMessage for alternateText or system message
    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.

  5. huult commented on Apr 1, 2025

    @huult
    Contributor

    Proposal

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

    Workspace description with markdown is shown as html tags in admin room system message

    What is the root cause of that problem?

    We still keep the HTML format for newDescription or oldDescription and return it as assigned.

    return message;

    children = <ReportActionItemBasicMessage message={getWorkspaceDescriptionUpdatedMessage(action)} />;

    And since we're using the component to render it, the HTML tags will be displayed as plain text — which leads to this issue

    <Text style={[styles.chatItemMessage, styles.colorMuted]}>{Str.htmlDecode(message)}</Text>

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

    To resolve this issue we just need use RenderHTML to render this message

    <Text style={[styles.chatItemMessage, styles.colorMuted]}>{Str.htmlDecode(message)}</Text>

    update to:

      <View style={[styles.chatItemMessage]}>
          <RenderHTML html={`<muted-text>${message}</muted-text>`} />
      </View>

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

    None

    What alternative solutions did you explore? (Optional)

    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.

  6. bernhardoj commented on Apr 4, 2025

    @bernhardoj
    Contributor

    Proposal

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

    The workspace description update system message shows HTML tag.

    What is the root cause of that problem?

    This happens after #53238 where we want to translate the admin system messages. Previously, the system message is rendered in HTML. But since now we render it using ReportActionItemBasicMessage, it will be rendered as a plain text.

    } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DESCRIPTION) {
    children = <ReportActionItemBasicMessage message={getWorkspaceDescriptionUpdatedMessage(action)} />;

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

    First, remove this case.

    } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DESCRIPTION) {
    children = <ReportActionItemBasicMessage message={getWorkspaceDescriptionUpdatedMessage(action)} />;

    We will let the message be rendered using ReportActionItemMessage. In getReportActionMessageFragments, add a new case for the description update system message.

    function getReportActionMessageFragments(action: ReportAction): Message[] {
    if (isOldDotReportAction(action)) {
    const oldDotMessage = getMessageOfOldDotReportAction(action);
    const html = isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.SELECTED_FOR_RANDOM_AUDIT) ? Parser.replace(oldDotMessage) : oldDotMessage;
    return [{text: oldDotMessage, html: `<muted-text>${html}</muted-text>`, type: 'COMMENT'}];
    }
    if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION)) {
    const message = getUpdateRoomDescriptionMessage(action);
    return [{text: message, html: `<muted-text>${message}</muted-text>`, type: 'COMMENT'}];
    }
    if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REIMBURSED)) {
    const message = getReportActionMessageText(action);
    return [{text: message, html: `<muted-text>${message}</muted-text>`, type: 'COMMENT'}];
    }
    const actionMessage = action.previousMessage ?? action.message;
    if (Array.isArray(actionMessage)) {
    return actionMessage.filter((item): item is Message => !!item);
    }
    return actionMessage ? [actionMessage] : [];
    }

    if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_DESCRIPTION)) {
        const message = getWorkspaceDescriptionUpdatedMessage(action);
        return [{text: message, html: `<muted-text>${message}</muted-text>`, type: 'COMMENT'}];
    }
    

    We can do the same for other action that suffers the same issue.

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

    Not really sure if we should add a test to `getReportActionMessageFragments for description update case since it's just a straightforward if case. If we want to add one, we can add it to the existing test suite.

  7. melvin-bot commented on Apr 7, 2025

    @melvin-bot

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

  8. melvin-bot commented on Apr 9, 2025

    @melvin-bot

    @adelekennedy 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  9. adelekennedy commented on Apr 11, 2025

    @adelekennedy
    Contributor
    Image

    I can reproduce - definitely a polish

  10. added
    External
    on Apr 11, 2025
  11. 46 remaining items

  12. melvin-bot commented on May 7, 2025

    @melvin-bot

    @rayane-d @adelekennedy @rayane-d 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]

  13. added
    Daily
    and removed
    Weekly
    on May 13, 2025
  14. melvin-bot commented on May 14, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@adelekennedy)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1910766257068312583/hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  15. rayane-d commented on May 15, 2025

    @rayane-d
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] 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/53238/files#r2091775402

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    • Create a workspace

    Test:

    1. Go to Settings > Workspaces > Select a workspace > Overview
    2. Update WS description so it contains markdown (example: test)
    3. Go to the #admins room
    4. Verify that the description update system message displays the markdown correctly without HTML tags

    Do we agree 👍 or 👎

  16. melvin-bot commented on May 16, 2025

    @melvin-bot

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

  17. adelekennedy commented on May 16, 2025

    @adelekennedy
    Contributor

    Payment Summary

    @bernhardoj owed $250 via NewDot
    @rayane-d owed $250 via NewDot

  18. bernhardoj commented on May 17, 2025

    @bernhardoj
    Contributor

    Requested in ND.

  19. JmillsExpensify commented on May 22, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

  20. rayane-d commented on Jun 3, 2025

    @rayane-d
    Contributor

    Requested in ND

  21. garrettmknight commented on Jun 5, 2025

    @garrettmknight
    Contributor

    $250 approved for @rayane-d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions