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
8 changes: 4 additions & 4 deletions src/libs/ModifiedExpenseMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ function getForReportAction({
buildMessageFragmentForValue(
// eslint-disable-next-line @typescript-eslint/no-deprecated
translateLocal,
Parser.htmlToMarkdown(reportActionOriginalMessage?.newComment ?? ''),
Parser.htmlToMarkdown(reportActionOriginalMessage?.oldComment ?? ''),
reportActionOriginalMessage?.newComment ?? '',
reportActionOriginalMessage?.oldComment ?? '',
descriptionLabel,
true,
setFragments,
Expand Down Expand Up @@ -643,8 +643,8 @@ function getForReportActionTemp({

buildMessageFragmentForValue(
translate,
Parser.htmlToMarkdown(reportActionOriginalMessage?.newComment ?? ''),
Parser.htmlToMarkdown(reportActionOriginalMessage?.oldComment ?? ''),
reportActionOriginalMessage?.newComment ?? '',
reportActionOriginalMessage?.oldComment ?? '',
descriptionLabel,
true,
setFragments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default {
currentUserLogin,
}: LocalNotificationModifiedExpensePushParams) {
const title = reportAction.person?.map((f) => f.text).join(', ') ?? '';
const body = getForReportActionTemp({
const bodyWithHTML = getForReportActionTemp({
// eslint-disable-next-line @typescript-eslint/no-deprecated -- translateLocal is deprecated; BrowserNotifications is non-React code that cannot use the translate hook
translate: translateLocal,
reportAction,
Expand All @@ -154,6 +154,8 @@ export default {
policyTags,
currentUserLogin,
});
// Strip HTML tags for plain text notification body
const body = getTextFromHtml(bodyWithHTML);
const icon = usesIcon ? EXPENSIFY_ICON_URL : '';
const data = {
reportID: report.reportID,
Expand Down
4 changes: 3 additions & 1 deletion src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
*/

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

Check warning on line 211 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

Check warning on line 211 in src/libs/OptionsListUtils/index.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 All @@ -220,7 +220,7 @@
const allSortedReportActions: Record<string, ReportAction[]> = {};
const cachedOneTransactionThreadReportIDs: Record<string, string | undefined> = {};
let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 223 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

Check warning on line 223 in src/libs/OptionsListUtils/index.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 @@ -265,7 +265,7 @@
});

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

Check warning on line 268 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

Check warning on line 268 in src/libs/OptionsListUtils/index.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.NVP_ACTIVE_POLICY_ID,
callback: (value) => (activePolicyID = value),
});
Expand Down Expand Up @@ -725,7 +725,7 @@
} else if (isReportMessageAttachment({text: report?.lastMessageText ?? '', html: report?.lastMessageHtml, type: ''})) {
lastMessageTextFromReport = `[${translate('common.attachment')}]`;
} else if (isModifiedExpenseAction(lastReportAction)) {
const properSchemaForModifiedExpenseMessage = policyTags
const properSchemaForModifiedExpenseMessageWithHTML = policyTags
? getForReportActionTemp({
translate,
reportAction: lastReportAction,
Expand All @@ -743,6 +743,8 @@
policyForMovingExpensesID,
currentUserLogin,
});
// Strip HTML tags for plain text display in options list
const properSchemaForModifiedExpenseMessage = Parser.htmlToText(properSchemaForModifiedExpenseMessageWithHTML);
lastMessageTextFromReport = formatReportLastMessageText(properSchemaForModifiedExpenseMessage, true);
} else if (isMovedTransactionAction(lastReportAction)) {
lastMessageTextFromReport = Parser.htmlToText(getMovedTransactionMessage(translate, lastReportAction));
Expand Down
4 changes: 3 additions & 1 deletion src/libs/ReportNameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ function computeChatThreadReportName(

const movedFromReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(parentReportAction, CONST.REPORT.MOVE_TYPE.FROM)}`];
const movedToReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(parentReportAction, CONST.REPORT.MOVE_TYPE.TO)}`];
const modifiedMessage = policyTags
const modifiedMessageWithHTML = policyTags
? getForReportActionTemp({
translate,
reportAction: parentReportAction,
Expand All @@ -768,6 +768,8 @@ function computeChatThreadReportName(
movedToReport,
currentUserLogin,
});
// Strip HTML tags for plain text display in report previews
const modifiedMessage = Parser.htmlToText(modifiedMessageWithHTML);
return formatReportLastMessageText(modifiedMessage);
}
if (isTripRoom(report) && report?.reportName !== CONST.REPORT.DEFAULT_REPORT_NAME) {
Expand Down
4 changes: 3 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@
Onyx.connect({
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined

Check warning on line 1050 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
if (!value) {
return;
}
Expand All @@ -1055,7 +1055,7 @@
currentUserEmail = value.email;
currentUserAccountID = value.accountID;
isAnonymousUser = value.authTokenType === CONST.AUTH_TOKEN_TYPES.ANONYMOUS;
currentUserPrivateDomain = isEmailPublicDomain(currentUserEmail ?? '') ? '' : Str.extractEmailDomain(currentUserEmail ?? '');

Check warning on line 1058 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
},
});

Expand All @@ -1073,7 +1073,7 @@
},
});

let allReportsDraft: OnyxCollection<Report>;

Check warning on line 1076 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
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
Expand All @@ -1085,7 +1085,7 @@
Onyx.connect({
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => {

Check warning on line 1088 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
allPolicies = value;
policiesArray = Object.values(value ?? {}).filter((policy): policy is Policy => !!policy);
},
Expand All @@ -1093,7 +1093,7 @@

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.POLICY_DRAFTS,

Check warning on line 1096 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
waitForCollectionCallback: true,
callback: (value) => (allPolicyDrafts = value),
});
Expand All @@ -1103,7 +1103,7 @@
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {

Check warning on line 1106 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
allReports = value;

if (!value) {
Expand All @@ -1111,7 +1111,7 @@
}

reportsByPolicyID = Object.entries(value).reduce<ReportByPolicyMap>((acc, [reportID, report]) => {
if (!report) {

Check warning on line 1114 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
return acc;
}

Expand Down Expand Up @@ -5884,14 +5884,16 @@

const movedFromReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(parentReportAction, CONST.REPORT.MOVE_TYPE.FROM)}`];
const movedToReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${getMovedReportID(parentReportAction, CONST.REPORT.MOVE_TYPE.TO)}`];
const modifiedMessage = getForReportAction({
const modifiedMessageWithHTML = getForReportAction({
reportAction: parentReportAction,
policyID,
movedFromReport,
movedToReport,
// Temporarily retrieves current user email from getCurrentUserEmail, since getReportName is deprecated and no longer requires this parameter to be passed explicitly.
currentUserLogin: getCurrentUserEmail() ?? '',
});
// Strip HTML tags for plain text display in report last message
const modifiedMessage = Parser.htmlToText(modifiedMessageWithHTML);
return formatReportLastMessageText(modifiedMessage);
}
if (isTripRoom(report) && report?.reportName !== CONST.REPORT.DEFAULT_REPORT_NAME) {
Expand Down
4 changes: 3 additions & 1 deletion src/pages/inbox/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ const ContextMenuActions: ContextMenuAction[] = [
const displayMessage = html ?? text;
setClipboardMessage(displayMessage);
} else if (isModifiedExpenseAction(reportAction)) {
const modifyExpenseMessage = getForReportActionTemp({
const modifyExpenseMessageWithHTML = getForReportActionTemp({
translate,
reportAction,
policy,
Expand All @@ -783,6 +783,8 @@ const ContextMenuActions: ContextMenuAction[] = [
policyTags,
currentUserLogin: currentUserPersonalDetails?.email ?? '',
});
// Convert HTML to markdown for clipboard copy to preserve links and formatting
const modifyExpenseMessage = Parser.htmlToMarkdown(modifyExpenseMessageWithHTML);
Clipboard.setString(modifyExpenseMessage);
} else if (isReimbursementDeQueuedOrCanceledAction(reportAction)) {
const displayMessage = getReimbursementDeQueuedOrCanceledActionMessage(translate, reportAction, report);
Expand Down
Loading