From 82334868f526c0698c88f12eb9648e7e97103e31 Mon Sep 17 00:00:00 2001 From: Steven KKC Date: Tue, 20 Jun 2023 09:14:35 -0400 Subject: [PATCH] fix error message when access workspace created with different default contact method --- src/libs/actions/Policy.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 8d253a36a77..0bd6b45172d 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -66,6 +66,12 @@ Onyx.connect({ callback: (val) => (personalDetails = val), }); +let loginList; +Onyx.connect({ + key: ONYXKEYS.LOGIN_LIST, + callback: (val) => (loginList = val), +}); + /** * Stores in Onyx the policy ID of the last workspace that was accessed by the user * @param {String|null} policyID @@ -157,7 +163,7 @@ function isAdminOfFreePolicy(policies) { * @returns {Boolean} */ function isPolicyOwner(policy) { - return policy.owner === sessionEmail; + return _.keys(loginList).includes(policy.owner); } /**