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

[CP Staging] Fix same name policy rooms and policy room title and mobile app crashing when creating policy room #6724

Merged
merged 6 commits into from
Dec 13, 2021
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
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;
}
Comment on lines +145 to +148
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isDefaultPolicy does not check for basic policy room, so we need to add this check here too.


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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to show similar style of title for both, default and policy rooms. I need to keep them separate though as the default dooms have subtitle and avatar, which is a different behaviour and design than policy room.

? 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