diff --git a/webapp/channels/src/actions/channel_actions.ts b/webapp/channels/src/actions/channel_actions.ts index 278bd830a4..41610c81f0 100644 --- a/webapp/channels/src/actions/channel_actions.ts +++ b/webapp/channels/src/actions/channel_actions.ts @@ -159,7 +159,9 @@ export function addUsersToChannel(channelId: Channel['id'], userIds: Array dispatch(ChannelActions.addChannelMember(channelId, uId))); - return await Promise.all(requests) as any; // HARRISONTODO This incorrectly returns an ActionResult[] + await Promise.all(requests); + + return {data: true}; } catch (error) { return {error}; } diff --git a/webapp/channels/src/actions/invite_actions.ts b/webapp/channels/src/actions/invite_actions.ts index 95c50c1c96..0237c3af7a 100644 --- a/webapp/channels/src/actions/invite_actions.ts +++ b/webapp/channels/src/actions/invite_actions.ts @@ -68,7 +68,7 @@ export function sendMembersInvites(teamId: string, users: UserProfile[], emails: data: emails.map((email) => ({ email, error: {error: localizeMessage('invite.members.unable-to-add-the-user-to-the-team', 'Unable to add the user to the team.')}, - })) as any, // HARRISONTODO These error handling cases return slightly different types + })) as unknown as TeamInviteWithError[], }; } const invitesWithErrors = response.data || []; @@ -184,8 +184,8 @@ export function sendGuestsInvites( data: emails.map((email) => ({ email, error: {error: localizeMessage('invite.guests.unable-to-add-the-user-to-the-channels', 'Unable to add the guest to the channels.')}, - })), - } as any; // HARRISONTODO These error handling cases return slightly different types + })) as unknown as TeamInviteWithError[], + }; } if (response.error) { @@ -281,7 +281,7 @@ export function sendMembersInvitesToChannels( data: emails.map((email) => ({ email, error: {error: localizeMessage('invite.members.unable-to-add-the-user-to-the-team', 'Unable to add the user to the team.')}, - })) as any, // HARRISONTODO These error handling cases return slightly different types + })) as unknown as TeamInviteWithError[], }; } const invitesWithErrors = response.data || []; diff --git a/webapp/channels/src/components/admin_console/system_users/system_users_dropdown/system_users_dropdown.tsx b/webapp/channels/src/components/admin_console/system_users/system_users_dropdown/system_users_dropdown.tsx index 62df220829..5be4774e98 100644 --- a/webapp/channels/src/components/admin_console/system_users/system_users_dropdown/system_users_dropdown.tsx +++ b/webapp/channels/src/components/admin_console/system_users/system_users_dropdown/system_users_dropdown.tsx @@ -135,7 +135,7 @@ export default class SystemUsersDropdown extends React.PureComponent Promise; + addUsersToChannel: (channelId: string, userIds: string[]) => Promise; getProfilesNotInChannel: (teamId: string, channelId: string, groupConstrained: boolean, page: number, perPage?: number) => Promise; getProfilesInChannel: (channelId: string, page: number, perPage: number, sort: string, options: {active?: boolean}) => Promise; getTeamStats: (teamId: string) => void; @@ -305,7 +305,7 @@ export class ChannelInviteModal extends React.PureComponent { this.setState({saving: true}); - actions.addUsersToChannel(channel.id, userIds).then((result: any) => { + actions.addUsersToChannel(channel.id, userIds).then((result) => { if (result.error) { this.handleInviteError(result.error); } else { diff --git a/webapp/channels/src/components/integrations/bots/bots.tsx b/webapp/channels/src/components/integrations/bots/bots.tsx index 2375e61e49..8f3070520c 100644 --- a/webapp/channels/src/components/integrations/bots/bots.tsx +++ b/webapp/channels/src/components/integrations/bots/bots.tsx @@ -118,7 +118,7 @@ export default class Bots extends React.PureComponent { public componentDidMount(): void { this.props.actions.loadBots( Constants.Integrations.START_PAGE_NUM, - parseInt(Constants.Integrations.PAGE_SIZE, 10), + Constants.Integrations.PAGE_SIZE, ).then( (result) => { if (result.data) { diff --git a/webapp/channels/src/components/integrations/installed_incoming_webhooks/installed_incoming_webhooks.tsx b/webapp/channels/src/components/integrations/installed_incoming_webhooks/installed_incoming_webhooks.tsx index 68f1b06383..c82c2a3cc8 100644 --- a/webapp/channels/src/components/integrations/installed_incoming_webhooks/installed_incoming_webhooks.tsx +++ b/webapp/channels/src/components/integrations/installed_incoming_webhooks/installed_incoming_webhooks.tsx @@ -53,7 +53,7 @@ export default class InstalledIncomingWebhooks extends React.PureComponent this.setState({loading: false}), ); diff --git a/webapp/channels/src/components/integrations/installed_outgoing_webhooks/installed_outgoing_webhooks.tsx b/webapp/channels/src/components/integrations/installed_outgoing_webhooks/installed_outgoing_webhooks.tsx index 221a26ded4..dc96590efc 100644 --- a/webapp/channels/src/components/integrations/installed_outgoing_webhooks/installed_outgoing_webhooks.tsx +++ b/webapp/channels/src/components/integrations/installed_outgoing_webhooks/installed_outgoing_webhooks.tsx @@ -99,7 +99,7 @@ export default class InstalledOutgoingWebhooks extends React.PureComponent this.setState({loading: false}), ); diff --git a/webapp/channels/src/utils/constants.tsx b/webapp/channels/src/utils/constants.tsx index c99223d608..90eb50677e 100644 --- a/webapp/channels/src/utils/constants.tsx +++ b/webapp/channels/src/utils/constants.tsx @@ -1931,7 +1931,7 @@ export const Constants = { }, Integrations: { COMMAND: 'commands', - PAGE_SIZE: '10000', + PAGE_SIZE: 10000, START_PAGE_NUM: 0, INCOMING_WEBHOOK: 'incoming_webhooks', OUTGOING_WEBHOOK: 'outgoing_webhooks', diff --git a/webapp/platform/client/src/client4.ts b/webapp/platform/client/src/client4.ts index ae533cfac8..492bea4c07 100644 --- a/webapp/platform/client/src/client4.ts +++ b/webapp/platform/client/src/client4.ts @@ -1535,7 +1535,7 @@ export default class Client4 { sendEmailGuestInvitesToChannelsGracefully = async (teamId: string, channelIds: string[], emails: string[], message: string) => { this.trackEvent('api', 'api_teams_invite_guests', {team_id: teamId, channel_ids: channelIds}); - return this.doFetch( + return this.doFetch( `${this.getTeamRoute(teamId)}/invite-guests/email?graceful=true`, {method: 'post', body: JSON.stringify({emails, channels: channelIds, message})}, ); diff --git a/webapp/platform/types/src/teams.ts b/webapp/platform/types/src/teams.ts index 055089657c..420587610e 100644 --- a/webapp/platform/types/src/teams.ts +++ b/webapp/platform/types/src/teams.ts @@ -109,5 +109,10 @@ export type NotPagedTeamSearchOpts = { export type TeamInviteWithError = { email: string; - error: ServerError; + + // Unlike ServerError, error uses field names directly from model.AppError on the server + error: { + id: string; + message: string; + }; };