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

Make workspace chat instantly available on workspace creation and when users are invited #8226

Merged
merged 3 commits into from
Mar 24, 2022
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
9 changes: 6 additions & 3 deletions src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`, {
Expand Down Expand Up @@ -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;
}

Expand Down