Skip to content

Commit

Permalink
Merge pull request #41222 from Expensify/revert-40272-fix/39495
Browse files Browse the repository at this point in the history
Revert "Add error for failure invited member"

(cherry picked from commit db37eb8)
  • Loading branch information
johnmlee101 authored and OSBotify committed Apr 29, 2024
1 parent 74c0af6 commit fbea7fd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 42 deletions.
3 changes: 0 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2408,9 +2408,6 @@ export default {
memberNotFound: 'Member not found. To invite a new member to the room, please use the Invite button above.',
notAuthorized: `You do not have access to this page. Are you trying to join the room? Please reach out to a member of this room so they can add you as a member! Something else? Reach out to ${CONST.EMAIL.CONCIERGE}`,
removeMembersPrompt: 'Are you sure you want to remove the selected members from the room?',
error: {
genericAdd: 'There was a problem adding this room member.',
},
},
newTaskPage: {
assignTask: 'Assign task',
Expand Down
3 changes: 0 additions & 3 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2439,9 +2439,6 @@ export default {
memberNotFound: 'Miembro no encontrado. Para invitar a un nuevo miembro a la sala de chat, por favor, utiliza el botón Invitar que está más arriba.',
notAuthorized: `No tienes acceso a esta página. ¿Estás tratando de unirte a la sala de chat? Comunícate con el propietario de esta sala de chat para que pueda añadirte como miembro. ¿Necesitas algo más? Comunícate con ${CONST.EMAIL.CONCIERGE}`,
removeMembersPrompt: '¿Estás seguro de que quieres eliminar a los miembros seleccionados de la sala de chat?',
error: {
genericAdd: 'Hubo un problema al añadir este miembro a la sala de chat.',
},
},
newTaskPage: {
assignTask: 'Asignar tarea',
Expand Down
34 changes: 9 additions & 25 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2662,18 +2662,17 @@ function inviteToRoom(reportID: string, inviteeEmailsToAccountIDs: InvitedEmails
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
pendingChatMembers:
pendingChatMembers.map((pendingChatMember) => {
if (!inviteeAccountIDs.includes(Number(pendingChatMember.accountID))) {
return pendingChatMember;
}
return {
...pendingChatMember,
errors: ErrorUtils.getMicroSecondOnyxError('roomMembersPage.error.genericAdd'),
};
}) ?? null,
participantAccountIDs: report.participantAccountIDs,
visibleChatMemberAccountIDs: report.visibleChatMemberAccountIDs,
participants: inviteeAccountIDs.reduce((revertedParticipants: Record<number, null>, accountID) => {
// eslint-disable-next-line no-param-reassign
revertedParticipants[accountID] = null;
return revertedParticipants;
}, {}),
pendingChatMembers: report?.pendingChatMembers ?? null,
},
},
...newPersonalDetailsOnyxData.finallyData,
];

if (ReportUtils.isGroupChat(report)) {
Expand All @@ -2696,20 +2695,6 @@ function inviteToRoom(reportID: string, inviteeEmailsToAccountIDs: InvitedEmails
API.write(WRITE_COMMANDS.INVITE_TO_ROOM, parameters, {optimisticData, successData, failureData});
}

function clearAddRoomMemberError(reportID: string, invitedAccountID: string) {
const report = currentReportData?.[reportID];
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
pendingChatMembers: report?.pendingChatMembers?.filter((pendingChatMember) => pendingChatMember.accountID !== invitedAccountID),
participantAccountIDs: report?.parentReportActionIDs?.filter((parentReportActionID) => parentReportActionID !== Number(invitedAccountID)),
participants: {
[invitedAccountID]: null,
},
});
Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, {
[invitedAccountID]: null,
});
}

function updateGroupChatMemberRoles(reportID: string, accountIDList: number[], role: ValueOf<typeof CONST.REPORT.ROLE>) {
const participants: Participants = {};
const memberRoles: Record<number, string> = {};
Expand Down Expand Up @@ -3796,5 +3781,4 @@ export {
leaveGroupChat,
removeFromGroupChat,
updateGroupChatMemberRoles,
clearAddRoomMemberError,
};
10 changes: 0 additions & 10 deletions src/pages/RoomMembersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) {
},
],
pendingAction: pendingChatMember?.pendingAction,
errors: pendingChatMember?.errors,
});
});

Expand All @@ -225,13 +224,6 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) {
return result;
};

const dismissError = useCallback(
(item: ListItem) => {
Report.clearAddRoomMemberError(report.reportID, String(item.accountID ?? ''));
},
[report.reportID],
);

const isPolicyEmployee = useMemo(() => {
if (!report?.policyID || policies === null) {
return false;
Expand All @@ -240,7 +232,6 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) {
}, [report?.policyID, policies]);
const data = getMemberOptions();
const headerMessage = searchValue.trim() && !data.length ? translate('roomMembersPage.memberNotFound') : '';

return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
Expand Down Expand Up @@ -309,7 +300,6 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) {
showScrollIndicator
shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()}
ListItem={UserListItem}
onDismissError={dismissError}
/>
</View>
</View>
Expand Down
1 change: 0 additions & 1 deletion src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type Note = OnyxCommon.OnyxValueWithOfflineFeedback<{
type PendingChatMember = {
accountID: string;
pendingAction: OnyxCommon.PendingAction;
errors?: OnyxCommon.Errors;
};

type Participant = {
Expand Down

0 comments on commit fbea7fd

Please sign in to comment.