From 0059079a4915d4a7e46ec5c496baaec16edd46bb Mon Sep 17 00:00:00 2001 From: Amal Nazeem Date: Fri, 18 Mar 2022 11:53:04 -0400 Subject: [PATCH 1/2] Make workspace chat instantly available for policy owner --- src/libs/actions/Policy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 1d7cb88e43d2..1de4e0371f59 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -130,8 +130,8 @@ function create(name = '') { Growl.show(Localize.translateLocal('workspace.common.growlMessageOnCreate'), CONST.GROWL.SUCCESS, 3000); res = response; - // Fetch the default reports on the policy - Report.fetchChatReportsByIDs([response.policy.chatReportIDAdmins, response.policy.chatReportIDAnnounce]); + // Fetch the default reports and the policyExpenseChat reports on the policy + Report.fetchChatReportsByIDs([response.policy.chatReportIDAdmins, response.policy.chatReportIDAnnounce, response.ownerPolicyExpenseChatID]); // We are awaiting this merge so that we can guarantee our policy is available to any React components connected to the policies collection before we navigate to a new route. return Onyx.merge(`${ONYXKEYS.COLLECTION.POLICY}${response.policyID}`, { From 295b487bb846cd8bd6b88371b236c2baf2db2673 Mon Sep 17 00:00:00 2001 From: Amal Nazeem Date: Wed, 23 Mar 2022 21:23:43 -0400 Subject: [PATCH 2/2] Fetch the latest policyExpenseChatIDs as we invite users to a policy --- src/libs/actions/Policy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 1de4e0371f59..ff1c1a2e304b 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -332,10 +332,13 @@ function invite(logins, welcomeNote, policyID) { policyID, }) .then((data) => { - // Save the personalDetails for the invited user in Onyx + // Save the personalDetails for the invited user in Onyx and fetch the latest policyExpenseChats if (data.jsonCode === 200) { Onyx.merge(ONYXKEYS.PERSONAL_DETAILS, PersonalDetails.formatPersonalDetails(data.personalDetails)); Navigation.goBack(); + if (!_.isEmpty(data.policyExpenseChatIDs)) { + Report.fetchChatReportsByIDs(data.policyExpenseChatIDs); + } return; }