Skip to content
Merged
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
18 changes: 9 additions & 9 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,14 @@ function canLeaveRoom(report, isPolicyMember) {
return true;
}

/**
* @param {string[]} participants
* @returns {Boolean}
*/
function isCurrentUserTheOnlyParticipant(participants) {
return participants && participants.length === 1 && participants[0] === sessionEmail;
}

/**
* Returns display names for those that can see the whisper.
* However, it returns "you" if the current user is the only one who can see it besides the person that sent it.
Expand All @@ -1711,7 +1719,7 @@ function canLeaveRoom(report, isPolicyMember) {
* @returns {string}
*/
function getWhisperDisplayNames(participants) {
const isWhisperOnlyVisibleToCurrentUSer = this.isCurrentUserTheOnlyParticipant(participants);
const isWhisperOnlyVisibleToCurrentUSer = isCurrentUserTheOnlyParticipant(participants);
Comment thread
aldo-expensify marked this conversation as resolved.
Resolved

// When the current user is the only participant, the display name needs to be "you" because that's the only person reading it
if (isWhisperOnlyVisibleToCurrentUSer) {
Expand All @@ -1721,14 +1729,6 @@ function getWhisperDisplayNames(participants) {
return _.map(participants, login => getDisplayNameForParticipant(login, !isWhisperOnlyVisibleToCurrentUSer)).join(', ');
}

/**
* @param {string[]} participants
* @returns {Boolean}
*/
function isCurrentUserTheOnlyParticipant(participants) {
return participants && participants.length === 1 && participants[0] === sessionEmail;
}

export {
getReportParticipantsTitle,
isReportMessageAttachment,
Expand Down