Merge branch 'Master' into 'Gitlab-OAuth2-support'

This commit is contained in:
ricardo
2020-07-23 14:57:37 -04:00
218 changed files with 13441 additions and 2381 deletions

View File

@@ -1,6 +1,7 @@
import {
IExecuteFunctions,
IHookFunctions,
ILoadOptionsFunctions,
} from 'n8n-core';
import {

View File

@@ -169,7 +169,10 @@ export class GitlabTrigger implements INodeType {
// Webhook got created before so check if it still exists
const owner = this.getNodeParameter('owner') as string;
const repository = this.getNodeParameter('repository') as string;
const endpoint = `/projects/${owner}%2F${repository}/hooks/${webhookData.webhookId}`;
const path = (`${owner}/${repository}`).replace(/\//g,'%2F');
const endpoint = `/projects/${path}/hooks/${webhookData.webhookId}`;
try {
await gitlabApiRequest.call(this, 'GET', endpoint, {});
@@ -209,15 +212,22 @@ export class GitlabTrigger implements INodeType {
events[`${e}_events`] = true;
}
const endpoint = `/projects/${owner}%2F${repository}/hooks`;
// gitlab set the push_events to true when the field it's not sent.
// set it to false when it's not picked by the user.
if (events['push_events'] === undefined) {
events['push_events'] = false;
}
const path = (`${owner}/${repository}`).replace(/\//g,'%2F');
const endpoint = `/projects/${path}/hooks`;
const body = {
url: webhookUrl,
events,
...events,
enable_ssl_verification: false,
};
let responseData;
try {
responseData = await gitlabApiRequest.call(this, 'POST', endpoint, body);
@@ -242,7 +252,10 @@ export class GitlabTrigger implements INodeType {
if (webhookData.webhookId !== undefined) {
const owner = this.getNodeParameter('owner') as string;
const repository = this.getNodeParameter('repository') as string;
const endpoint = `/projects/${owner}%2F${repository}/hooks/${webhookData.webhookId}`;
const path = (`${owner}/${repository}`).replace(/\//g,'%2F');
const endpoint = `/projects/${path}/hooks/${webhookData.webhookId}`;
const body = {};
try {