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

fix: 24420 Timezone message for assignee disappears #25534

Merged
merged 5 commits into from
Sep 1, 2023
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
20 changes: 16 additions & 4 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,18 @@ function hasAutomatedExpensifyAccountIDs(accountIDs) {
return _.intersection(accountIDs, CONST.EXPENSIFY_ACCOUNT_IDS).length > 0;
}

/**
* @param {Object} report
* @param {Number} currentLoginAccountID
* @returns {Array}
*/
function getReportRecipientAccountIDs(report, currentLoginAccountID) {
const participantAccountIDs = isTaskReport(report) ? [report.managerID] : lodashGet(report, 'participantAccountIDs');
const reportParticipants = _.without(participantAccountIDs, currentLoginAccountID);
const participantsWithoutExpensifyAccountIDs = _.difference(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS);
return participantsWithoutExpensifyAccountIDs;
}

/**
* Whether the time row should be shown for a report.
* @param {Array<Object>} personalDetails
Expand All @@ -807,10 +819,9 @@ function hasAutomatedExpensifyAccountIDs(accountIDs) {
* @return {Boolean}
*/
function canShowReportRecipientLocalTime(personalDetails, report, accountID) {
const reportParticipants = _.without(lodashGet(report, 'participantAccountIDs', []), accountID);
const participantsWithoutExpensifyAccountIDs = _.difference(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS);
const hasMultipleParticipants = participantsWithoutExpensifyAccountIDs.length > 1;
const reportRecipient = personalDetails[participantsWithoutExpensifyAccountIDs[0]];
const reportRecipientAccountIDs = getReportRecipientAccountIDs(report, accountID);
const hasMultipleParticipants = reportRecipientAccountIDs.length > 1;
const reportRecipient = personalDetails[reportRecipientAccountIDs[0]];
const reportRecipientTimezone = lodashGet(reportRecipient, 'timezone', CONST.DEFAULT_TIME_ZONE);
const isReportParticipantValidated = lodashGet(reportRecipient, 'validated', false);
return Boolean(
Expand Down Expand Up @@ -3494,6 +3505,7 @@ export {
shouldDisableSettings,
shouldDisableRename,
hasSingleParticipant,
getReportRecipientAccountIDs,
isOneOnOneChat,
getTransactionReportName,
getTransactionDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ function ReportActionCompose({
() => _.without(lodashGet(report, 'participantAccountIDs', []), currentUserPersonalDetails.accountID),
[currentUserPersonalDetails.accountID, report],
);
const participantsWithoutExpensifyAccountIDs = useMemo(() => _.difference(reportParticipantIDs, CONST.EXPENSIFY_ACCOUNT_IDS), [reportParticipantIDs]);

const shouldShowReportRecipientLocalTime = useMemo(
() => ReportUtils.canShowReportRecipientLocalTime(personalDetails, report, currentUserPersonalDetails.accountID) && !isComposerFullSize,
Expand Down Expand Up @@ -309,7 +308,8 @@ function ReportActionCompose({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const reportRecipient = personalDetails[participantsWithoutExpensifyAccountIDs[0]];
const reportRecipientAcountIDs = ReportUtils.getReportRecipientAccountIDs(report, currentUserPersonalDetails.accountID);
const reportRecipient = personalDetails[reportRecipientAcountIDs[0]];
const shouldUseFocusedColor = !isBlockedFromConcierge && !disabled && isFocused;

const hasReportRecipient = _.isObject(reportRecipient) && !_.isEmpty(reportRecipient);
Expand Down
Loading