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

Create personal detail optimistic data when inviting member to the room #32788

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Changes from 2 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
7 changes: 7 additions & 0 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as ErrorUtils from '@libs/ErrorUtils';
import Log from '@libs/Log';
import Navigation from '@libs/Navigation/Navigation';
import LocalNotification from '@libs/Notification/LocalNotification';
import * as OptionsListUtils from '@libs/OptionsListUtils';
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
import * as Pusher from '@libs/Pusher/pusher';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
Expand Down Expand Up @@ -2119,6 +2120,9 @@ function inviteToRoom(reportID, inviteeEmailsToAccountIDs) {
const {participantAccountIDs} = report;
const participantAccountIDsAfterInvitation = _.uniq([...participantAccountIDs, ...inviteeAccountIDs]);

const logins = _.map(inviteeEmails, (memberLogin) => OptionsListUtils.addSMSDomainIfPhoneNumber(memberLogin));
const newPersonalDetailsOnyxData = PersonalDetailsUtils.getNewPersonalDetailsOnyxData(logins, inviteeAccountIDs);

API.write(
'InviteToRoom',
{
Expand All @@ -2134,7 +2138,9 @@ function inviteToRoom(reportID, inviteeEmailsToAccountIDs) {
participantAccountIDs: participantAccountIDsAfterInvitation,
},
},
...newPersonalDetailsOnyxData.optimisticData,
],
successData: newPersonalDetailsOnyxData.successData,
failureData: [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand All @@ -2143,6 +2149,7 @@ function inviteToRoom(reportID, inviteeEmailsToAccountIDs) {
participantAccountIDs,
},
},
...newPersonalDetailsOnyxData.failureData,
],
},
);
Expand Down
Loading