Skip to content
Closed
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
5 changes: 3 additions & 2 deletions src/components/LHNOptionsList/OptionRowLHN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import DateUtils from '@libs/DateUtils';
import DomUtils from '@libs/DomUtils';
import {containsCustomEmoji as containsCustomEmojiUtils, containsOnlyCustomEmoji} from '@libs/EmojiUtils';
import {shouldOptionShowTooltip, shouldUseBoldText} from '@libs/OptionsListUtils';
import Parser from '@libs/Parser';
import Performance from '@libs/Performance';
import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager';
import {isAdminRoom, isChatUsedForOnboarding as isChatUsedForOnboardingReportUtils, isConciergeChatReport, isGroupChat, isOneOnOneChat, isSystemChat} from '@libs/ReportUtils';
Expand Down Expand Up @@ -295,12 +296,12 @@ function OptionRowLHN({
>
{alternateTextContainsCustomEmojiWithText ? (
<TextWithEmojiFragment
message={optionItem.alternateText}
message={Parser.htmlToText(optionItem.alternateText)}
style={[alternateTextStyle, styles.mh0]}
alignCustomEmoji
/>
) : (
optionItem.alternateText
Parser.htmlToText(optionItem.alternateText)
)}
</Text>
)}
Expand Down
14 changes: 7 additions & 7 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
*/
let currentUserLogin: string | undefined;
let currentUserAccountID: number | undefined;
Onyx.connect({

Check warning on line 188 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.SESSION,
callback: (value) => {
currentUserLogin = value?.email;
Expand All @@ -194,19 +194,19 @@
});

let loginList: OnyxEntry<Login>;
Onyx.connect({

Check warning on line 197 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.LOGIN_LIST,
callback: (value) => (loginList = isEmptyObject(value) ? {} : value),
});

let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
Onyx.connect({

Check warning on line 203 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.PERSONAL_DETAILS_LIST,
callback: (value) => (allPersonalDetails = isEmptyObject(value) ? {} : value),
});

const policies: OnyxCollection<Policy> = {};
Onyx.connect({

Check warning on line 209 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.POLICY,
callback: (policy, key) => {
if (!policy || !key || !policy.name) {
Expand All @@ -218,14 +218,14 @@
});

let allPolicies: OnyxCollection<Policy> = {};
Onyx.connect({

Check warning on line 221 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.POLICY,
waitForCollectionCallback: true,
callback: (val) => (allPolicies = val),
});

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

Check warning on line 228 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 @@ -234,7 +234,7 @@
});

let allReportNameValuePairs: OnyxCollection<ReportNameValuePairs>;
Onyx.connect({

Check warning on line 237 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_NAME_VALUE_PAIRS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -246,7 +246,7 @@
const allSortedReportActions: Record<string, ReportAction[]> = {};
let allReportActions: OnyxCollection<ReportActions>;
const lastVisibleReportActions: ReportActions = {};
Onyx.connect({

Check warning on line 249 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 @@ -306,13 +306,13 @@
});

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

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

let nvpDismissedProductTraining: OnyxEntry<DismissedProductTraining>;
Onyx.connect({

Check warning on line 315 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_DISMISSED_PRODUCT_TRAINING,
callback: (value) => (nvpDismissedProductTraining = value),
});
Expand Down Expand Up @@ -457,7 +457,7 @@
const isAnnounceRoom = reportUtilsIsAnnounceRoom(report);
const isGroupChat = reportUtilsIsGroupChat(report);
const isExpenseThread = isMoneyRequest(report);
const formattedLastMessageText = formatReportLastMessageText(option.lastMessageText ?? '');
const formattedLastMessageText = formatReportLastMessageText(Parser.htmlToText(option.lastMessageText ?? ''));
const reportPrefix = getReportSubtitlePrefix(report);
const formattedLastMessageTextWithPrefix = reportPrefix + formattedLastMessageText;

Expand Down Expand Up @@ -639,7 +639,7 @@
const movedTransactionOriginalMessage = getOriginalMessage(lastReportAction) ?? {};
const {toReportID} = movedTransactionOriginalMessage as OriginalMessageMovedTransaction;
const toReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${toReportID}`];
lastMessageTextFromReport = Parser.htmlToText(getMovedTransactionMessage(toReport));
lastMessageTextFromReport = getMovedTransactionMessage(toReport);
} else if (isTaskAction(lastReportAction)) {
lastMessageTextFromReport = formatReportLastMessageText(getTaskReportActionMessage(lastReportAction).text);
} else if (isCreatedTaskReportAction(lastReportAction)) {
Expand All @@ -651,14 +651,14 @@
) {
const wasSubmittedViaHarvesting = !isMarkAsClosedAction(lastReportAction) ? (getOriginalMessage(lastReportAction)?.harvesting ?? false) : false;
if (wasSubmittedViaHarvesting) {
lastMessageTextFromReport = Parser.htmlToText(translateLocal('iou.automaticallySubmitted'));
lastMessageTextFromReport = translateLocal('iou.automaticallySubmitted');
} else {
lastMessageTextFromReport = translateLocal('iou.submitted', {memo: getOriginalMessage(lastReportAction)?.message});
}
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED)) {
const {automaticAction} = getOriginalMessage(lastReportAction) ?? {};
if (automaticAction) {
lastMessageTextFromReport = Parser.htmlToText(translateLocal('iou.automaticallyApproved'));
lastMessageTextFromReport = translateLocal('iou.automaticallyApproved');
} else {
lastMessageTextFromReport = translateLocal('iou.approvedMessage');
}
Expand All @@ -667,7 +667,7 @@
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.FORWARDED)) {
const {automaticAction} = getOriginalMessage(lastReportAction) ?? {};
if (automaticAction) {
lastMessageTextFromReport = Parser.htmlToText(translateLocal('iou.automaticallyForwarded'));
lastMessageTextFromReport = translateLocal('iou.automaticallyForwarded');
} else {
lastMessageTextFromReport = translateLocal('iou.forwarded');
}
Expand Down Expand Up @@ -708,9 +708,9 @@
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.DELETED_TRANSACTION)) {
lastMessageTextFromReport = getDeletedTransactionMessage(lastReportAction);
} else if (isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL) || isActionOfType(lastReportAction, CONST.REPORT.ACTIONS.TYPE.REROUTE)) {
lastMessageTextFromReport = Parser.htmlToText(getChangedApproverActionMessage(lastReportAction));
lastMessageTextFromReport = getChangedApproverActionMessage(lastReportAction);
} else if (isMovedAction(lastReportAction)) {
lastMessageTextFromReport = Parser.htmlToText(getMovedActionMessage(lastReportAction, report));
lastMessageTextFromReport = getMovedActionMessage(lastReportAction, report);
}

// we do not want to show report closed in LHN for non archived report so use getReportLastMessage as fallback instead of lastMessageText from report
Expand Down
12 changes: 6 additions & 6 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ function getOptionData({
} else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.TEAM_DOWNGRADE)) {
result.alternateText = translateLocal('workspaceActions.downgradedWorkspace');
} else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED)) {
result.alternateText = Parser.htmlToText(getIntegrationSyncFailedMessage(lastAction, report?.policyID));
result.alternateText = getIntegrationSyncFailedMessage(lastAction, report?.policyID);
} else if (
isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_CATEGORY) ||
isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CATEGORY) ||
Expand Down Expand Up @@ -836,7 +836,7 @@ function getOptionData({
} else if (isCardIssuedAction(lastAction)) {
result.alternateText = getCardIssuedMessage({reportAction: lastAction, expensifyCard: card});
} else if (lastAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && lastActorDisplayName && lastMessageTextFromReport) {
result.alternateText = formatReportLastMessageText(`${lastActorDisplayName}: ${lastMessageText}`);
result.alternateText = formatReportLastMessageText(Parser.htmlToText(`${lastActorDisplayName}: ${lastMessageText}`));
} else if (lastAction && isOldDotReportAction(lastAction)) {
result.alternateText = getMessageOfOldDotReportAction(lastAction);
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION) {
Expand All @@ -848,7 +848,7 @@ function getOptionData({
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_EMPLOYEE) {
result.alternateText = getPolicyChangeLogDeleteMemberMessage(lastAction);
} else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION)) {
result.alternateText = Parser.htmlToText(getUnreportedTransactionMessage());
result.alternateText = getUnreportedTransactionMessage();
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) {
result.alternateText = getReportActionMessageText(lastAction) ?? '';
} else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_INTEGRATION) {
Expand All @@ -872,7 +872,7 @@ function getOptionData({
} else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.TRAVEL_UPDATE)) {
result.alternateText = getTravelUpdateMessage(lastAction);
} else if (isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.TAKE_CONTROL) || isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.REROUTE)) {
result.alternateText = Parser.htmlToText(getChangedApproverActionMessage(lastAction));
result.alternateText = getChangedApproverActionMessage(lastAction);
} else {
result.alternateText =
lastMessageTextFromReport.length > 0
Expand All @@ -894,9 +894,9 @@ function getOptionData({
);
}
if (shouldShowLastActorDisplayName(report, lastActorDetails, lastAction) && !isReportArchived) {
result.alternateText = `${lastActorDisplayName}: ${formatReportLastMessageText(lastMessageText)}`;
result.alternateText = `${lastActorDisplayName}: ${formatReportLastMessageText(Parser.htmlToText(lastMessageText))}`;
} else {
result.alternateText = formatReportLastMessageText(lastMessageText);
result.alternateText = formatReportLastMessageText(Parser.htmlToText(lastMessageText));
}
}

Expand Down
Loading