Skip to content

Commit

Permalink
Merge pull request #36981 from Expensify/Rory-AllowRawHTML
Browse files Browse the repository at this point in the history
[No QA] Allow raw HTML on web with a flag
  • Loading branch information
roryabraham authored Feb 21, 2024
2 parents 6989089 + 4d854c8 commit 5bf8fad
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import * as PersonalDetailsUtils from './PersonalDetailsUtils';
import * as PolicyUtils from './PolicyUtils';
import type {LastVisibleMessage} from './ReportActionsUtils';
import * as ReportActionsUtils from './ReportActionsUtils';
import shouldAllowRawHTMLMessages from './shouldAllowRawHTMLMessages';
import * as TransactionUtils from './TransactionUtils';
import * as Url from './Url';
import * as UserUtils from './UserUtils';
Expand Down Expand Up @@ -2697,7 +2698,7 @@ function hasReportNameError(report: OnyxEntry<Report>): boolean {
*/
function getParsedComment(text: string): string {
const parser = new ExpensiMark();
return text.length <= CONST.MAX_MARKUP_LENGTH ? parser.replace(text) : lodashEscape(text);
return text.length <= CONST.MAX_MARKUP_LENGTH ? parser.replace(text, {shouldEscapeText: !shouldAllowRawHTMLMessages()}) : lodashEscape(text);
}

function getReportDescriptionText(report: Report): string {
Expand Down
3 changes: 3 additions & 0 deletions src/libs/shouldAllowRawHTMLMessages/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function () {
return false;
}
5 changes: 5 additions & 0 deletions src/libs/shouldAllowRawHTMLMessages/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
window.shouldAllowRawHTMLMessages = false;

export default function () {
return window.shouldAllowRawHTMLMessages;
}
1 change: 1 addition & 0 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ declare module '*.lottie' {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface Window {
setSupportToken: (token: string, email: string, accountID: number) => void;
shouldAllowRawHTMLMessages: boolean;
}

0 comments on commit 5bf8fad

Please sign in to comment.