Skip to content

Commit

Permalink
Merge pull request #30974 from dukenv0307/fix/30575
Browse files Browse the repository at this point in the history
Fix: Incorrect LHN subtitle when last message is flagged as assault
  • Loading branch information
tylerkaraszewski authored Nov 13, 2023
2 parents 63570cd + d0b69c9 commit 629c6de
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,7 @@ function getAllReportErrors(report, reportActions) {
* @returns {String}
*/
function getLastMessageTextForReport(report) {
const lastReportAction = _.find(
allSortedReportActions[report.reportID],
(reportAction, key) => ReportActionUtils.shouldReportActionBeVisible(reportAction, key) && reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
);
const lastReportAction = _.find(allSortedReportActions[report.reportID], (reportAction) => ReportActionUtils.shouldReportActionBeVisibleAsLastAction(reportAction));
let lastMessageTextFromReport = '';
const lastActionName = lodashGet(lastReportAction, 'actionName', '');

Expand Down Expand Up @@ -415,18 +412,6 @@ function getLastMessageTextForReport(report) {
lastMessageTextFromReport = lodashGet(lastReportAction, 'message[0].text', '');
} else {
lastMessageTextFromReport = report ? report.lastMessageText || '' : '';

// Yeah this is a bit ugly. If the latest report action that is not a whisper has been moderated as pending remove
// then set the last message text to the text of the latest visible action that is not a whisper or the report creation message.
const lastNonWhisper = _.find(allSortedReportActions[report.reportID], (action) => !ReportActionUtils.isWhisperAction(action)) || {};
if (ReportActionUtils.isPendingRemove(lastNonWhisper)) {
const latestVisibleAction =
_.find(
allSortedReportActions[report.reportID],
(action) => ReportActionUtils.shouldReportActionBeVisibleAsLastAction(action) && !ReportActionUtils.isCreatedAction(action),
) || {};
lastMessageTextFromReport = lodashGet(latestVisibleAction, 'message[0].text', '');
}
}
return lastMessageTextFromReport;
}
Expand Down

0 comments on commit 629c6de

Please sign in to comment.