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
17 changes: 5 additions & 12 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,22 +441,15 @@ function isArchivedRoom(report) {
* @returns {String}
*/
function getPolicyName(report) {
// Public rooms send back the policy name with the reportSummary,
// since they can also be accessed by people who aren't in the workspace
if (report.policyName) {
return report.policyName;
}

if (!allPolicies || _.size(allPolicies) === 0) {
if ((!allPolicies || _.size(allPolicies) === 0) && !report.policyName) {
return Localize.translateLocal('workspace.common.unavailable');
}
Comment on lines +444 to 446

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this needed @dukenv0307?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, I see now that its needed. Else, we might show an old report name.

const policy = _.get(allPolicies, `${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`);

const policy = allPolicies[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
if (!policy) {
return report.oldPolicyName || Localize.translateLocal('workspace.common.unavailable');
}
// // 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 policy.name || report.oldPolicyName || Localize.translateLocal('workspace.common.unavailable');
return lodashGet(policy, 'name') || report.policyName || report.oldPolicyName || Localize.translateLocal('workspace.common.unavailable');
}

/**
Expand Down