Skip to content

Commit

Permalink
Merge pull request #22410 from rezkiy37/fix/21891-invited-users-offline
Browse files Browse the repository at this point in the history
Fix invited members does not reflect in offline mode
  • Loading branch information
madmax330 authored Aug 7, 2023
2 parents de13796 + 3b7448e commit ab4dc4b
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,25 @@ function addMembersToWorkspace(invitedEmailsToAccountIDs, welcomeNote, policyID,
onyxMethod: Onyx.METHOD.MERGE,
key: membersListKey,

// Convert to object with each key clearing pendingAction. We don’t
// need to remove the members since that will be handled by onClose of OfflineWithFeedback.
value: _.object(accountIDs, Array(accountIDs.length).fill({pendingAction: null, errors: null})),
// Convert to object with each key clearing pendingAction, when it is an existing account.
// Remove the object, when it is a newly created account.
value: _.reduce(
accountIDs,
(accountIDsWithClearedPendingAction, accountID) => {
let value = null;
const accountAlreadyExists = !_.isEmpty(allPersonalDetails[accountID]);

if (accountAlreadyExists) {
value = {pendingAction: null, errors: null};
}

// eslint-disable-next-line no-param-reassign
accountIDsWithClearedPendingAction[accountID] = value;

return accountIDsWithClearedPendingAction;
},
{},
),
},
...newPersonalDetailsOnyxData.successData,
...membersChats.onyxSuccessData,
Expand Down

0 comments on commit ab4dc4b

Please sign in to comment.