-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[CP Staging] Fix regression #23189 #23240
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
Changes from all commits
5521d4b
77801b4
41051a4
66d74ae
2b6f5cd
fd7ff20
2a5d4e2
44ccbd6
9cd441b
c6f8e6e
ad3ce9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -505,9 +505,10 @@ function isArchivedRoom(report) { | |||
| * @param {String} report.oldPolicyName | ||||
| * @param {String} report.policyName | ||||
| * @param {Boolean} [returnEmptyIfNotFound] | ||||
| * @param {Object} [policy] | ||||
| * @returns {String} | ||||
| */ | ||||
| function getPolicyName(report, returnEmptyIfNotFound = false) { | ||||
| function getPolicyName(report, returnEmptyIfNotFound = false, policy = undefined) { | ||||
| const noPolicyFound = returnEmptyIfNotFound ? '' : Localize.translateLocal('workspace.common.unavailable'); | ||||
| if (_.isEmpty(report)) { | ||||
| return noPolicyFound; | ||||
|
|
@@ -516,12 +517,12 @@ function getPolicyName(report, returnEmptyIfNotFound = false) { | |||
| if ((!allPolicies || _.size(allPolicies) === 0) && !report.policyName) { | ||||
| return Localize.translateLocal('workspace.common.unavailable'); | ||||
| } | ||||
| const policy = _.get(allPolicies, `${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`); | ||||
| const finalPolicy = policy || _.get(allPolicies, `${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`); | ||||
|
|
||||
| // // Public rooms send back the policy name with the reportSummary, | ||||
| // // since they can also be accessed by people who aren't in the workspace | ||||
| // Public rooms send back the policy name with the reportSummary, | ||||
| // since they can also be accessed by people who aren't in the workspace | ||||
|
|
||||
| return lodashGet(policy, 'name') || report.policyName || report.oldPolicyName || noPolicyFound; | ||||
| return lodashGet(finalPolicy, 'name') || report.policyName || report.oldPolicyName || noPolicyFound; | ||||
| } | ||||
|
|
||||
| /** | ||||
|
|
@@ -785,10 +786,11 @@ function getIconsForParticipants(participants, personalDetails) { | |||
| * Given a report, return the associated workspace icon. | ||||
| * | ||||
| * @param {Object} report | ||||
| * @param {Object} [policy] | ||||
| * @returns {Object} | ||||
| */ | ||||
| function getWorkspaceIcon(report) { | ||||
| const workspaceName = getPolicyName(report); | ||||
| function getWorkspaceIcon(report, policy = undefined) { | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while its true, we found in other places that its more expressive. It conveys the meaning, that you don't have to set policy. App/.github/libs/ActionUtils.js Line 28 in 450573e
|
||||
| const workspaceName = getPolicyName(report, false, policy); | ||||
| const policyExpenseChatAvatarSource = lodashGet(allPolicies, [`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, 'avatar']) || getDefaultWorkspaceAvatar(workspaceName); | ||||
| const workspaceIcon = { | ||||
| source: policyExpenseChatAvatarSource, | ||||
|
|
@@ -809,9 +811,10 @@ function getWorkspaceIcon(report) { | |||
| * @param {Boolean} [isPayer] | ||||
| * @param {String} [defaultName] | ||||
| * @param {Number} [defaultAccountID] | ||||
| * @param {Object} [policy] | ||||
| * @returns {Array<*>} | ||||
| */ | ||||
| function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, defaultName = '', defaultAccountID = -1) { | ||||
| function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, defaultName = '', defaultAccountID = -1, policy = undefined) { | ||||
| if (_.isEmpty(report)) { | ||||
| const fallbackIcon = { | ||||
| source: defaultIcon || Expensicons.FallbackAvatar, | ||||
|
|
@@ -823,7 +826,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, | |||
| } | ||||
| if (isExpenseRequest(report)) { | ||||
| const parentReportAction = ReportActionsUtils.getParentReportAction(report); | ||||
| const workspaceIcon = getWorkspaceIcon(report); | ||||
| const workspaceIcon = getWorkspaceIcon(report, policy); | ||||
| const memberIcon = { | ||||
| source: UserUtils.getAvatar(lodashGet(personalDetails, [parentReportAction.actorAccountID, 'avatar']), parentReportAction.actorAccountID), | ||||
| id: parentReportAction.actorAccountID, | ||||
|
|
@@ -846,7 +849,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, | |||
| }; | ||||
|
|
||||
| if (isWorkspaceThread(report)) { | ||||
| const workspaceIcon = getWorkspaceIcon(report); | ||||
| const workspaceIcon = getWorkspaceIcon(report, policy); | ||||
| return [actorIcon, workspaceIcon]; | ||||
| } | ||||
| return [actorIcon]; | ||||
|
|
@@ -860,7 +863,7 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, | |||
| }; | ||||
|
|
||||
| if (isWorkspaceTaskReport(report)) { | ||||
| const workspaceIcon = getWorkspaceIcon(report); | ||||
| const workspaceIcon = getWorkspaceIcon(report, policy); | ||||
| return [ownerIcon, workspaceIcon]; | ||||
| } | ||||
|
|
||||
|
|
@@ -879,11 +882,11 @@ function getIcons(report, personalDetails, defaultIcon = null, isPayer = false, | |||
| return [domainIcon]; | ||||
| } | ||||
| if (isAdminRoom(report) || isAnnounceRoom(report) || isChatRoom(report) || isArchivedRoom(report)) { | ||||
| const workspaceIcon = getWorkspaceIcon(report); | ||||
| const workspaceIcon = getWorkspaceIcon(report, policy); | ||||
| return [workspaceIcon]; | ||||
| } | ||||
| if (isPolicyExpenseChat(report) || isExpenseReport(report)) { | ||||
| const workspaceIcon = getWorkspaceIcon(report); | ||||
| const workspaceIcon = getWorkspaceIcon(report, policy); | ||||
| const memberIcon = { | ||||
| source: UserUtils.getAvatar(lodashGet(personalDetails, [report.ownerAccountID, 'avatar']), report.ownerAccountID), | ||||
| id: report.ownerAccountID, | ||||
|
|
@@ -1032,14 +1035,15 @@ function getMoneyRequestTotal(report, moneyRequestReports = {}) { | |||
| * Get the title for a policy expense chat which depends on the role of the policy member seeing this report | ||||
| * | ||||
| * @param {Object} report | ||||
| * @param {Object} [policy] | ||||
| * @returns {String} | ||||
| */ | ||||
| function getPolicyExpenseChatName(report) { | ||||
| function getPolicyExpenseChatName(report, policy = undefined) { | ||||
| const reportOwnerDisplayName = getDisplayNameForParticipant(report.ownerAccountID) || lodashGet(allPersonalDetails, [report.ownerAccountID, 'login']) || report.reportName; | ||||
|
|
||||
| // If the policy expense chat is owned by this user, use the name of the policy as the report name. | ||||
| if (report.isOwnPolicyExpenseChat) { | ||||
| return getPolicyName(report); | ||||
| return getPolicyName(report, false, policy); | ||||
| } | ||||
|
|
||||
| const policyExpenseChatRole = lodashGet(allPolicies, [`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, 'role']) || 'user'; | ||||
|
|
@@ -1050,7 +1054,7 @@ function getPolicyExpenseChatName(report) { | |||
| const lastAction = ReportActionsUtils.getLastVisibleAction(report.reportID); | ||||
| const archiveReason = (lastAction && lastAction.originalMessage && lastAction.originalMessage.reason) || CONST.REPORT.ARCHIVE_REASON.DEFAULT; | ||||
| if (archiveReason === CONST.REPORT.ARCHIVE_REASON.ACCOUNT_MERGED && policyExpenseChatRole !== CONST.POLICY.ROLE.ADMIN) { | ||||
| return getPolicyName(report); | ||||
| return getPolicyName(report, false, policy); | ||||
| } | ||||
| } | ||||
|
|
||||
|
|
@@ -1062,11 +1066,12 @@ function getPolicyExpenseChatName(report) { | |||
| * Get the title for a IOU or expense chat which will be showing the payer and the amount | ||||
| * | ||||
| * @param {Object} report | ||||
| * @param {Object} [policy] | ||||
| * @returns {String} | ||||
| */ | ||||
| function getMoneyRequestReportName(report) { | ||||
| function getMoneyRequestReportName(report, policy = undefined) { | ||||
| const formattedAmount = CurrencyUtils.convertToDisplayString(getMoneyRequestTotal(report), report.currency); | ||||
| const payerName = isExpenseReport(report) ? getPolicyName(report) : getDisplayNameForParticipant(report.managerID); | ||||
| const payerName = isExpenseReport(report) ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(report.managerID); | ||||
|
|
||||
| return Localize.translateLocal(report.hasOutstandingIOU ? 'iou.payerOwesAmount' : 'iou.payerPaidAmount', {payer: payerName, amount: formattedAmount}); | ||||
| } | ||||
|
|
@@ -1121,9 +1126,10 @@ function getReportPreviewMessage(report, reportAction = {}) { | |||
| * Get the title for a report. | ||||
| * | ||||
| * @param {Object} report | ||||
| * @param {Object} [policy] | ||||
| * @returns {String} | ||||
| */ | ||||
| function getReportName(report) { | ||||
| function getReportName(report, policy = undefined) { | ||||
| let formattedName; | ||||
| if (isChatThread(report)) { | ||||
| const parentReportAction = ReportActionsUtils.getParentReportAction(report); | ||||
|
|
@@ -1149,11 +1155,11 @@ function getReportName(report) { | |||
| } | ||||
|
|
||||
| if (isPolicyExpenseChat(report)) { | ||||
| formattedName = getPolicyExpenseChatName(report); | ||||
| formattedName = getPolicyExpenseChatName(report, policy); | ||||
| } | ||||
|
|
||||
| if (isMoneyRequestReport(report)) { | ||||
| formattedName = getMoneyRequestReportName(report); | ||||
| formattedName = getMoneyRequestReportName(report, policy); | ||||
| } | ||||
|
|
||||
| if (isArchivedRoom(report)) { | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ const propTypes = { | |
|
|
||
| currentUserPersonalDetails: personalDetailsPropType, | ||
|
|
||
| priorityMode: PropTypes.oneOf(_.values(CONST.OPTION_MODE)), | ||
| priorityMode: PropTypes.oneOf(_.values(CONST.PRIORITY_MODE)), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this changed?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was causing a warning, please check #23240 (comment)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, the onyx value we read is the priority mode, it has been wrong in the first place to check for OPTION_MODE, which is not what we are working with (we changed it to PRIORITY_MODE)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! |
||
|
|
||
| ...withLocalizePropTypes, | ||
| }; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.