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

show closed action message when a workspace member is removed #8778

Merged
merged 11 commits into from
Apr 26, 2022
2 changes: 1 addition & 1 deletion src/components/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const OptionRow = (props) => {
{
!_.isEmpty(props.option.icons)
&& (
props.option.shouldShowSubscript ? (
props.option.shouldShowSubscript && props.option.icons.length > 1 ? (
marcochavezf marked this conversation as resolved.
Show resolved Hide resolved
<SubscriptAvatar
mainAvatar={props.option.icons[0]}
secondaryAvatar={props.option.icons[1]}
Expand Down
11 changes: 10 additions & 1 deletion src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import CONST from '../CONST';
import * as ReportUtils from './reportUtils';
import * as Localize from './Localize';
import Permissions from './Permissions';
import * as ReportActions from './actions/ReportActions';

/**
* OptionsListUtils is used to build a list options passed to the OptionsList component. Several different UI views can
Expand Down Expand Up @@ -221,11 +222,19 @@ function createOption(logins, personalDetails, report, {
const lastMessageTextFromReport = ReportUtils.isReportMessageAttachment({text: lodashGet(report, 'lastMessageText', ''), html: lodashGet(report, 'lastMessageHtml', '')})
? `[${Localize.translateLocal('common.attachment')}]`
: Str.htmlDecode(lodashGet(report, 'lastMessageText', ''));
let lastMessageText = report && !isArchivedRoom && hasMultipleParticipants && lastActorDetails
let lastMessageText = report && hasMultipleParticipants && lastActorDetails
? `${lastActorDetails.displayName}: `
: '';
lastMessageText += report ? lastMessageTextFromReport : '';

if (isPolicyExpenseChat && isArchivedRoom) {
const archiveReason = lodashGet(ReportActions.getLastAction(report.reportID), 'originalMessage.reason', CONST.REPORT.ARCHIVE_REASON.DEFAULT);
lastMessageText = Localize.translate(preferredLocale, `reportArchiveReasons.${archiveReason}`, {
displayName: lastActorDetails.displayName,
policyName: ReportUtils.getPolicyName(report, policies),
});
}

const tooltipText = ReportUtils.getReportParticipantsTitle(lodashGet(report, ['participants'], []));
const subtitle = ReportUtils.getChatRoomSubtitle(report, policies);
let text;
Expand Down
5 changes: 5 additions & 0 deletions src/libs/actions/ReportActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,14 @@ function getLastVisibleMessageText(reportID) {
);
}

function getLastAction(reportID) {
marcochavezf marked this conversation as resolved.
Show resolved Hide resolved
return _.last(reportActions[reportID]);
}

export {
isReportMissingActions,
dangerouslyGetReportActionsMaxSequenceNumber,
getDeletedCommentsCount,
getLastAction,
getLastVisibleMessageText,
};
2 changes: 1 addition & 1 deletion src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const HeaderView = (props) => {
}}
style={[styles.flexRow, styles.alignItemsCenter, styles.flex1]}
>
{shouldShowSubscript ? (
{shouldShowSubscript && icons.length > 1 ? (
<SubscriptAvatar
mainAvatar={icons[0]}
secondaryAvatar={icons[1]}
Expand Down