Skip to content
Merged
Show file tree
Hide file tree
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/libs/ReportActionFollowupUtils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import render from 'dom-serializer';
import {DomUtils, parseDocument} from 'htmlparser2';
import {getReportActionMessage, isActionOfType} from '@libs/ReportActionsUtils';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -53,7 +54,7 @@ function parseFollowupsFromHtml(html: string): Followup[] | null {
const followupTextElement = DomUtils.getElementsByTagName('followup-text', followupEl, true).at(0);
const followupResponseElement = DomUtils.getElementsByTagName('followup-response', followupEl, true).at(0);
const text = followupTextElement ? DomUtils.textContent(followupTextElement) : '';
const response = followupResponseElement ? DomUtils.textContent(followupResponseElement) : undefined;
const response = followupResponseElement ? render(followupResponseElement.children) : undefined;
return {text, response};
});
}
Expand Down
4 changes: 3 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@
reportID?: string;
reportActionID?: string;
attachmentID?: string;
isHTML?: boolean;
};

type OptimisticReportAction = {
Expand Down Expand Up @@ -1049,7 +1050,7 @@
};

let conciergeReportIDOnyxConnect: OnyxEntry<string>;
Onyx.connect({

Check warning on line 1053 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportIDOnyxConnect = value;
Expand All @@ -1057,7 +1058,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 1061 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -1075,7 +1076,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 1079 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -1087,7 +1088,7 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 1091 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
Expand All @@ -1095,7 +1096,7 @@

let allPolicies: OnyxCollection<Policy>;
let policiesArray: Policy[] = [];
Onyx.connect({

Check warning on line 1099 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1105,7 +1106,7 @@
});

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1109 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_DRAFTS,
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
Expand All @@ -1113,7 +1114,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 1117 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1149,14 +1150,14 @@
});

let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
Onyx.connect({

Check warning on line 1153 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETA_CONFIGURATION,
callback: (value) => (betaConfiguration = value ?? {}),
});

let deprecatedAllTransactions: OnyxCollection<Transaction> = {};
let deprecatedReportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1160 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1182,7 +1183,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1186 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -6399,8 +6400,9 @@
reportID,
reportActionID = rand64(),
attachmentID,
isHTML = false,
}: BuildOptimisticAddCommentReportActionParams): OptimisticReportAction {
const commentText = getParsedComment(text ?? '', {reportID});
const commentText = isHTML ? (text ?? '') : getParsedComment(text ?? '', {reportID});
const attachmentHtml = getUploadingAttachmentHtml(file, attachmentID);

const htmlForNewComment = `${commentText}${commentText && attachmentHtml ? '<br /><br />' : ''}${attachmentHtml}`;
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/Report/SuggestedFollowup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ function resolveSuggestedFollowup(
const optimisticConciergeAction = buildOptimisticAddCommentReportAction({
text: selectedFollowup.response,
actorAccountID: CONST.ACCOUNT_ID.CONCIERGE,
createdOffset: 1,
reportActionID: optimisticConciergeReportActionID,
reportID,
isHTML: true,
});

addOptimisticConciergeActionWithDelay(reportID, optimisticConciergeAction);
Expand Down
8 changes: 5 additions & 3 deletions src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Navigation from '@libs/Navigation/Navigation';
import Parser from '@libs/Parser';
import {getCleanedTagName, isPolicyAdmin} from '@libs/PolicyUtils';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import stripFollowupListFromHtml from '@libs/ReportActionFollowupUtils/stripFollowupListFromHtml';
import {
getActionableCardFraudAlertMessage,
getActionableMentionWhisperMessage,
Expand Down Expand Up @@ -214,14 +215,15 @@ function getActionHtml(reportAction: OnyxInputOrEntry<ReportAction>): string {

/** Sets the HTML string to Clipboard */
function setClipboardMessage(content: string | undefined) {
if (!content) {
const strippedContent = stripFollowupListFromHtml(content);
if (!strippedContent) {
return;
}
const clipboardText = getClipboardText(content);
const clipboardText = getClipboardText(strippedContent);
if (!Clipboard.canSetHtml()) {
Clipboard.setString(clipboardText);
} else {
Clipboard.setHtml(content, clipboardText);
Clipboard.setHtml(strippedContent, clipboardText);
}
}

Expand Down
Loading