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

[CP Staging] Fix workspace description shows as HTML in workspace invite message page #45745

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/pages/workspace/WorkspaceInviteMessagePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import Parser from '@libs/Parser';
import * as PolicyUtils from '@libs/PolicyUtils';
import updateMultilineInputRange from '@libs/updateMultilineInputRange';
import type {SettingsNavigatorParamList} from '@navigation/types';
Expand Down Expand Up @@ -83,7 +84,7 @@ function WorkspaceInviteMessagePage({
workspaceInviteMessageDraft ||
// policy?.description can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
policy?.description ||
Parser.htmlToMarkdown(policy?.description ?? '') ||
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We got an issue where an HTML is shown in the invite message page. This happens when you set the workspace description with a markdown. The description is saved as HTML, so we need to convert it back to markdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before our PR, we covert the HTML to markdown in

if (!isEmptyObject(invitedEmailsToAccountIDsDraft)) {
setWelcomeNote(getDefaultWelcomeNote());
return;

but that has its flaw too because it will convert the message draft HTML to markdown. For example, if user type <b>test</b>, go back and reopen the page, they will see *b*.

So, what we did already correct, but we missed moving the htmlToMarkdown to the workspace description.

translate('workspace.common.welcomeNote', {
workspaceName: policy?.name ?? '',
});
Expand Down
Loading