Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for [Deleted message] keeps showing up #30131

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
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function OptionRowLHN(props) {
numberOfLines={1}
accessibilityLabel={translate('accessibilityHints.lastChatMessagePreview')}
>
{optionItem.isLastMessageDeletedParentAction ? translate('parentReportAction.deletedMessage') : optionItem.alternateText}
{optionItem.alternateText}
</Text>
) : null}
</View>
Expand Down
2 changes: 0 additions & 2 deletions src/libs/SidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ function getOptionData(report, reportActions, personalDetails, preferredLocale,
isMoneyRequestReport: false,
isExpenseRequest: false,
isWaitingOnBankAccount: false,
isLastMessageDeletedParentAction: false,
isAllowedToComment: true,
};

Expand Down Expand Up @@ -429,7 +428,6 @@ function getOptionData(report, reportActions, personalDetails, preferredLocale,
result.icons = ReportUtils.getIcons(report, personalDetails, UserUtils.getAvatar(personalDetail.avatar, personalDetail.accountID), '', -1, policy);
result.searchText = OptionsListUtils.getSearchText(report, reportName, participantPersonalDetailList, result.isChatRoom || result.isPolicyExpenseChat, result.isThread);
result.displayNamesWithTooltips = displayNamesWithTooltips;
result.isLastMessageDeletedParentAction = report.isLastMessageDeletedParentAction;

if (status) {
result.status = status;
Expand Down
27 changes: 9 additions & 18 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ function addActions(reportID, text = '', file) {
lastMessageHtml: lastCommentText,
lastActorAccountID: currentUserAccountID,
lastReadTime: currentTime,
isLastMessageDeletedParentAction: null,
};

// Optimistically add the new actions to the store before waiting to save them to the server
Expand Down Expand Up @@ -1047,25 +1046,17 @@ function deleteReportComment(reportID, reportAction) {
lastMessageText: '',
lastVisibleActionCreated: '',
};
if (reportAction.childVisibleActionCount === 0) {
const {lastMessageText = '', lastMessageTranslationKey = ''} = ReportUtils.getLastVisibleMessage(originalReportID, optimisticReportActions);
if (lastMessageText || lastMessageTranslationKey) {
const lastVisibleAction = ReportActionsUtils.getLastVisibleAction(originalReportID, optimisticReportActions);
const lastVisibleActionCreated = lodashGet(lastVisibleAction, 'created');
const lastActorAccountID = lodashGet(lastVisibleAction, 'actorAccountID');
optimisticReport = {
lastMessageTranslationKey: '',
lastMessageText: '',
isLastMessageDeletedParentAction: true,
lastMessageTranslationKey,
lastMessageText,
lastVisibleActionCreated,
lastActorAccountID,
};
} else {
const {lastMessageText = '', lastMessageTranslationKey = ''} = ReportUtils.getLastVisibleMessage(originalReportID, optimisticReportActions);
if (lastMessageText || lastMessageTranslationKey) {
const lastVisibleAction = ReportActionsUtils.getLastVisibleAction(originalReportID, optimisticReportActions);
const lastVisibleActionCreated = lodashGet(lastVisibleAction, 'created');
const lastActorAccountID = lodashGet(lastVisibleAction, 'actorAccountID');
optimisticReport = {
lastMessageTranslationKey,
lastMessageText,
lastVisibleActionCreated,
lastActorAccountID,
};
}
}

// If the API call fails we must show the original message again, so we revert the message content back to how it was
Expand Down
Loading