Skip to content

Commit

Permalink
Merge pull request #6724 from Expensify/vit-fixRoomName
Browse files Browse the repository at this point in the history
[CP Staging] Fix same name policy rooms and policy room title and mobile app crashing when creating policy room
  • Loading branch information
Amal Nazeem authored Dec 13, 2021
2 parents 2ecdbbc + 9bbd555 commit ab6b887
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function getParticipantEmailsFromReport({sharedReportList}) {
}

/**
* Returns the title for a default room or generates one based on the participants
* Returns the title for a default room, a policy room or generates one based on the participants
*
* @param {Object} fullReport
* @param {String} chatType
Expand All @@ -142,6 +142,11 @@ function getChatReportName(fullReport, chatType) {
: '')}`;
}

// For a basic policy room, return its original name
if (ReportUtils.isPolicyRoom({chatType})) {
return fullReport.reportName;
}

const {sharedReportList} = fullReport;
return _.chain(sharedReportList)
.map(participant => participant.email)
Expand Down
5 changes: 3 additions & 2 deletions src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ const HeaderView = (props) => {
};
},
);
const isPolicyRoom = ReportUtils.isPolicyRoom(props.report);
const isDefaultChatRoom = ReportUtils.isDefaultRoom(props.report);
const title = isDefaultChatRoom
const title = isDefaultChatRoom || isPolicyRoom
? props.report.reportName
: _.map(displayNamesWithTooltips, ({displayName}) => displayName).join(', ');

Expand Down Expand Up @@ -145,7 +146,7 @@ const HeaderView = (props) => {
tooltipEnabled
numberOfLines={1}
textStyles={[styles.headerText]}
shouldUseFullTitle={isDefaultChatRoom}
shouldUseFullTitle={isDefaultChatRoom || isPolicyRoom}
/>
{isDefaultChatRoom && (
<ExpensifyText
Expand Down

0 comments on commit ab6b887

Please sign in to comment.