mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 21:07:28 -08:00
fix(Slack Node): User id not sent correctly to API when updating user profile (#11153)
Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com>
This commit is contained in:
parent
c70969da2b
commit
ed9e61c460
|
@ -79,6 +79,16 @@ export async function slackApiRequest(
|
||||||
level: 'warning',
|
level: 'warning',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} else if (response.error === 'not_admin') {
|
||||||
|
throw new NodeOperationError(
|
||||||
|
this.getNode(),
|
||||||
|
'Need higher Role Level for this Operation (e.g. Owner or Admin Rights)',
|
||||||
|
{
|
||||||
|
description:
|
||||||
|
'Hint: Check the Role of your Slack App Integration. For more information see the Slack Documentation - https://slack.com/help/articles/360018112273-Types-of-roles-in-Slack',
|
||||||
|
level: 'warning',
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new NodeOperationError(
|
throw new NodeOperationError(
|
||||||
|
@ -86,6 +96,7 @@ export async function slackApiRequest(
|
||||||
'Slack error response: ' + JSON.stringify(response.error),
|
'Slack error response: ' + JSON.stringify(response.error),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.ts !== undefined) {
|
if (response.ts !== undefined) {
|
||||||
Object.assign(response, { message_timestamp: response.ts });
|
Object.assign(response, { message_timestamp: response.ts });
|
||||||
delete response.ts;
|
delete response.ts;
|
||||||
|
|
|
@ -1299,18 +1299,29 @@ export class SlackV2 implements INodeType {
|
||||||
|
|
||||||
options.fields = fields;
|
options.fields = fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(body, options);
|
Object.assign(body, options);
|
||||||
|
let requestBody: IDataObject = { profile: body };
|
||||||
|
|
||||||
|
let userId;
|
||||||
|
if (options.user) {
|
||||||
|
userId = options.user;
|
||||||
|
delete body.user;
|
||||||
|
requestBody = { profile: body, user: userId };
|
||||||
|
}
|
||||||
|
|
||||||
responseData = await slackApiRequest.call(
|
responseData = await slackApiRequest.call(
|
||||||
this,
|
this,
|
||||||
'POST',
|
'POST',
|
||||||
'/users.profile.set',
|
'/users.profile.set',
|
||||||
{ profile: body },
|
requestBody,
|
||||||
qs,
|
qs,
|
||||||
);
|
);
|
||||||
|
|
||||||
responseData = responseData.profile;
|
responseData = responseData.profile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resource === 'userGroup') {
|
if (resource === 'userGroup') {
|
||||||
//https://api.slack.com/methods/usergroups.create
|
//https://api.slack.com/methods/usergroups.create
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
|
|
Loading…
Reference in a new issue