Skip to content

Commit

Permalink
Merge pull request #7197 from Expensify/cmartins-userPolicyRoomText
Browse files Browse the repository at this point in the history
Change the default text for User-Created Policy Rooms
  • Loading branch information
Gonals authored Jan 14, 2022
2 parents de8d439 + 65eed05 commit a445c5b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 26 deletions.
57 changes: 35 additions & 22 deletions src/components/ReportWelcomeText.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,32 +67,45 @@ const ReportWelcomeText = (props) => {
},
);
const chatUsers = props.shouldIncludeParticipants ? displayNamesWithTooltips : [{displayName: props.report.reportName}];
const isResctrictedRoom = lodashGet(props, 'report.visibility', '') === CONST.REPORT.VISIBILITY.RESTRICTED;

return (
<Text style={[styles.mt3, styles.w70, styles.textAlignCenter]}>
<Text>
{!props.shouldIncludeParticipants
? `${props.translate('reportActionsView.beginningOfChatHistoryPrivatePartOne')}`
: `${props.translate('reportActionsView.beginningOfChatHistory')} `}
</Text>
{!props.shouldIncludeParticipants && <Text style={[styles.textStrong]}>{` ${lodashGet(chatUsers, '[0].displayName', '')}`}</Text>}
{!props.shouldIncludeParticipants && <Text>{props.translate('reportActionsView.beginningOfChatHistoryPrivatePartTwo')}</Text>}
{props.shouldIncludeParticipants
&& (
<>
{_.map(chatUsers, ({displayName, pronouns}, index) => (
<Text key={displayName}>
<Text style={[styles.textStrong]}>
{displayName}
</Text>
{!_.isEmpty(pronouns) && <Text>{` (${pronouns})`}</Text>}
{(index === chatUsers.length - 1) && <Text>.</Text>}
{(index === chatUsers.length - 2) && <Text>{` ${props.translate('common.and')} `}</Text>}
{(index < chatUsers.length - 2) && <Text>, </Text>}
{!props.shouldIncludeParticipants
? (
<>
<Text>
{isResctrictedRoom
? `${props.translate('reportActionsView.beginningOfChatHistoryRestrictedPartOne')}`
: `${props.translate('reportActionsView.beginningOfChatHistoryPrivatePartOne')}`}
</Text>
<Text style={[styles.textStrong]}>
{lodashGet(chatUsers, '[0].displayName', '')}
</Text>
<Text>
{isResctrictedRoom
? `${props.translate('reportActionsView.beginningOfChatHistoryRestrictedPartTwo')}`
: `${props.translate('reportActionsView.beginningOfChatHistoryPrivatePartTwo')}`}
</Text>
))}
</>
)}
</>
) : (
<>
<Text>
{props.translate('reportActionsView.beginningOfChatHistory')}
</Text>
{_.map(chatUsers, ({displayName, pronouns}, index) => (
<Text key={displayName}>
<Text style={[styles.textStrong]}>
{displayName}
</Text>
{!_.isEmpty(pronouns) && <Text>{` (${pronouns})`}</Text>}
{(index === chatUsers.length - 1) && <Text>.</Text>}
{(index === chatUsers.length - 2) && <Text>{` ${props.translate('common.and')} `}</Text>}
{(index < chatUsers.length - 2) && <Text>, </Text>}
</Text>
))}
</>
)}
</Text>
);
};
Expand Down
6 changes: 4 additions & 2 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ export default {
deleteConfirmation: 'Are you sure you want to delete this comment?',
},
reportActionsView: {
beginningOfChatHistory: 'This is the beginning of your chat history with',
beginningOfChatHistoryPrivatePartOne: 'This is the beginning of the private',
beginningOfChatHistory: 'This is the beginning of your chat history with ',
beginningOfChatHistoryPrivatePartOne: 'This is the beginning of the private ',
beginningOfChatHistoryRestrictedPartOne: 'This is the beginning of ',
beginningOfChatHistoryPrivatePartTwo: ' room, invite others by @mentioning them.',
beginningOfChatHistoryRestrictedPartTwo: ', invite others by @mentioning them.',
},
reportActionsViewMarkerBadge: {
newMsg: ({count}) => `${count} new message${count > 1 ? 's' : ''}`,
Expand Down
6 changes: 4 additions & 2 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ export default {
deleteConfirmation: '¿Estás seguro de que quieres eliminar este comentario?',
},
reportActionsView: {
beginningOfChatHistory: 'Aquí comienza tu historial de conversaciones con',
beginningOfChatHistoryPrivatePartOne: 'Este es el principio de la sala privada',
beginningOfChatHistory: 'Aquí comienza tu historial de conversaciones con ',
beginningOfChatHistoryPrivatePartOne: 'Este es el principio de la sala privada ',
beginningOfChatHistoryRestrictedPartOne: 'Este es el principio de ',
beginningOfChatHistoryPrivatePartTwo: ', invita a otros @mencionándolos.',
beginningOfChatHistoryRestrictedPartTwo: ', invita a otros @mencionándolos.',
},
reportActionsViewMarkerBadge: {
newMsg: ({count}) => `${count} mensaje${count > 1 ? 's' : ''} nuevo${count > 1 ? 's' : ''}`,
Expand Down

0 comments on commit a445c5b

Please sign in to comment.