diff options
author | Lauri Ojansivu <x@xet7.org> | 2017-09-01 23:01:34 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2017-09-01 23:01:34 +0300 |
commit | e041f55254e7a2ac48c25cbc70f6977dd2447270 (patch) | |
tree | e525719e1bb20fb16fa7cd142330a405fdb7197d /client/components/boards/boardHeader.js | |
parent | 491a352792238abf58ba9d973b5009bff581f904 (diff) | |
parent | ba9f4fa7b7e5654bcc93251a0b75e958e1015e7f (diff) | |
download | wekan-e041f55254e7a2ac48c25cbc70f6977dd2447270.tar.gz wekan-e041f55254e7a2ac48c25cbc70f6977dd2447270.tar.bz2 wekan-e041f55254e7a2ac48c25cbc70f6977dd2447270.zip |
Merge branch 'andresmanelli-devel' into devel
Add more than one Outgoing Webhook. Thanks to andresmanelli !
Diffstat (limited to 'client/components/boards/boardHeader.js')
-rw-r--r-- | client/components/boards/boardHeader.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index 2ee21905..b7807ca9 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -241,39 +241,44 @@ BlazeComponent.extendComponent({ }).register('boardChangeWatchPopup'); BlazeComponent.extendComponent({ - integration() { + integrations() { const boardId = Session.get('currentBoard'); - return Integrations.findOne({ boardId: `${boardId}` }); + return Integrations.find({ boardId: `${boardId}` }).fetch(); + }, + + integration(id) { + const boardId = Session.get('currentBoard'); + return Integrations.findOne({ _id: id, boardId: `${boardId}` }); }, events() { return [{ 'submit'(evt) { evt.preventDefault(); - const url = this.find('.js-outgoing-webhooks-url').value.trim(); + const url = evt.target.url.value; const boardId = Session.get('currentBoard'); - const integration = this.integration(); - if (integration) { + let id = null; + let integration = null; + if (evt.target.id) { + id = evt.target.id.value; + integration = this.integration(id); if (url) { Integrations.update(integration._id, { $set: { - enabled: true, url: `${url}`, }, }); } else { - Integrations.update(integration._id, { - $set: { - enabled: false, - }, - }); + Integrations.remove(integration._id); } } else if (url) { Integrations.insert({ + userId: Meteor.userId(), enabled: true, type: 'outgoing-webhooks', url: `${url}`, boardId: `${boardId}`, + activities: ['all'], }); } Popup.close(); |