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

Fix: invite and remove member when offline in workspace #30627

Merged
merged 8 commits into from
Nov 6, 2023
Merged
Changes from 1 commit
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
13 changes: 7 additions & 6 deletions src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ function hasActiveFreePolicy(policies) {
}

/**
* Build optimistic data for adding users from announce room
* Build optimistic data to the announce room
neil-marcellini marked this conversation as resolved.
Show resolved Hide resolved
* @param {String} policyID
* @param {Object} invitedEmailsToAccountIDs
* @param {Array} accountIDs
* @returns {Object}
*/
function createOptimisticAnnounceRoomMembers(policyID, invitedEmailsToAccountIDs) {
function buildAnnounceRoomMembersOnyxData(policyID, accountIDs) {
const announceReport = ReportUtils.getRoom(CONST.REPORT.CHAT_TYPE.POLICY_ANNOUNCE, policyID);
const announceRoomMembers = {
onyxOptimisticData: [],
Expand All @@ -230,7 +230,7 @@ function createOptimisticAnnounceRoomMembers(policyID, invitedEmailsToAccountIDs
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${announceReport.reportID}`,
value: {
participantAccountIDs: [...announceReport.participantAccountIDs, ..._.values(invitedEmailsToAccountIDs)],
participantAccountIDs: [...announceReport.participantAccountIDs, ...accountIDs],
},
});

Expand All @@ -245,7 +245,7 @@ function createOptimisticAnnounceRoomMembers(policyID, invitedEmailsToAccountIDs
}

/**
* Build optimistic data for removing users from announce room
* Build optimistic data for removing users to the announce room
neil-marcellini marked this conversation as resolved.
Show resolved Hide resolved
* @param {String} policyID
* @param {Array} accountIDs
* @returns {Object}
Expand Down Expand Up @@ -487,7 +487,8 @@ function addMembersToWorkspace(invitedEmailsToAccountIDs, welcomeNote, policyID)
const accountIDs = _.values(invitedEmailsToAccountIDs);
const newPersonalDetailsOnyxData = PersonalDetailsUtils.getNewPersonalDetailsOnyxData(logins, accountIDs);

const announceRoomMembers = createOptimisticAnnounceRoomMembers(policyID, invitedEmailsToAccountIDs);
const announceRoomMembers = buildAnnounceRoomMembersOnyxData(policyID, accountIDs);

// create onyx data for policy expense chats for each new member
const membersChats = createPolicyExpenseChats(policyID, invitedEmailsToAccountIDs);

Expand Down
Loading