adding error for when invite request fails (#24436)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com> Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -42,12 +42,18 @@ export function sendMembersInvites(teamId: string, users: UserProfile[], emails:
|
|||||||
if (usersToAdd.length > 0) {
|
if (usersToAdd.length > 0) {
|
||||||
const response = await dispatch(addUsersToTeam(teamId, usersToAdd.map((u) => u.id)));
|
const response = await dispatch(addUsersToTeam(teamId, usersToAdd.map((u) => u.id)));
|
||||||
const members = response.data || [];
|
const members = response.data || [];
|
||||||
for (const userToAdd of usersToAdd) {
|
if (response.error) {
|
||||||
const memberWithError = members.find((m: TeamMemberWithError) => m.user_id === userToAdd.id && m.error);
|
for (const userToAdd of usersToAdd) {
|
||||||
if (memberWithError) {
|
notSent.push({user: userToAdd, reason: response.error.message});
|
||||||
notSent.push({user: userToAdd, reason: memberWithError.error.message});
|
}
|
||||||
} else {
|
} else {
|
||||||
sent.push({user: userToAdd, reason: localizeMessage('invite.members.added-to-team', 'This member has been added to the team.')});
|
for (const userToAdd of usersToAdd) {
|
||||||
|
const memberWithError = members.find((m: TeamMemberWithError) => m.user_id === userToAdd.id && m.error);
|
||||||
|
if (memberWithError) {
|
||||||
|
notSent.push({user: userToAdd, reason: memberWithError.error.message});
|
||||||
|
} else {
|
||||||
|
sent.push({user: userToAdd, reason: localizeMessage('invite.members.added-to-team', 'This member has been added to the team.')});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,12 +238,18 @@ export function sendMembersInvitesToChannels(
|
|||||||
if (usersToAdd.length > 0) {
|
if (usersToAdd.length > 0) {
|
||||||
const response = await dispatch(addUsersToTeam(teamId, usersToAdd.map((u) => u.id)));
|
const response = await dispatch(addUsersToTeam(teamId, usersToAdd.map((u) => u.id)));
|
||||||
const members = response.data || [];
|
const members = response.data || [];
|
||||||
for (const userToAdd of usersToAdd) {
|
if (response.error) {
|
||||||
const memberWithError = members.find((m: TeamMemberWithError) => m.user_id === userToAdd.id && m.error);
|
for (const userToAdd of usersToAdd) {
|
||||||
if (memberWithError) {
|
notSent.push({user: userToAdd, reason: response.error.message});
|
||||||
notSent.push({user: userToAdd, reason: memberWithError.error.message});
|
}
|
||||||
} else {
|
} else {
|
||||||
sent.push({user: userToAdd, reason: localizeMessage('invite.members.added-to-team', 'This member has been added to the team.')});
|
for (const userToAdd of usersToAdd) {
|
||||||
|
const memberWithError = members.find((m: TeamMemberWithError) => m.user_id === userToAdd.id && m.error);
|
||||||
|
if (memberWithError) {
|
||||||
|
notSent.push({user: userToAdd, reason: memberWithError.error.message});
|
||||||
|
} else {
|
||||||
|
sent.push({user: userToAdd, reason: localizeMessage('invite.members.added-to-team', 'This member has been added to the team.')});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user