summaryrefslogtreecommitdiffstats
path: root/client/components/boards/boardHeader.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-07-12 02:30:53 +0300
committerLauri Ojansivu <x@xet7.org>2017-07-12 02:30:53 +0300
commitafa5ec360f61d8c891bc4058c3fc96525af4f4fa (patch)
treefb691f47d8b455c1b9e12d8d169d29e1a02d095f /client/components/boards/boardHeader.js
parent19a71c0d9295b3d1e595ceb711eadca7bac3a868 (diff)
parentc649c87d16c7269452aa9fff17293db8be550bd5 (diff)
downloadwekan-afa5ec360f61d8c891bc4058c3fc96525af4f4fa.tar.gz
wekan-afa5ec360f61d8c891bc4058c3fc96525af4f4fa.tar.bz2
wekan-afa5ec360f61d8c891bc4058c3fc96525af4f4fa.zip
Merge branch 'nztqa-improve-notify' into devel
Add Feature: Outgoing Webhooks. Thanks to nztqa !
Diffstat (limited to 'client/components/boards/boardHeader.js')
-rw-r--r--client/components/boards/boardHeader.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js
index c8b44824..dafbfd30 100644
--- a/client/components/boards/boardHeader.js
+++ b/client/components/boards/boardHeader.js
@@ -13,6 +13,7 @@ Template.boardMenuPopup.events({
// confirm that the board was successfully archived.
FlowRouter.go('home');
}),
+ 'click .js-outgoing-webhooks': Popup.open('outgoingWebhooks'),
});
Template.boardMenuPopup.helpers({
@@ -234,3 +235,45 @@ BlazeComponent.extendComponent({
}];
},
}).register('boardChangeWatchPopup');
+
+BlazeComponent.extendComponent({
+ integration() {
+ const boardId = Session.get('currentBoard');
+ return Integrations.findOne({ boardId: `${boardId}` });
+ },
+
+ events() {
+ return [{
+ 'submit'(evt) {
+ evt.preventDefault();
+ const url = this.find('.js-outgoing-webhooks-url').value.trim();
+ const boardId = Session.get('currentBoard');
+ const integration = this.integration();
+ if (integration) {
+ if (url) {
+ Integrations.update(integration._id, {
+ $set: {
+ enabled: true,
+ url: `${url}`,
+ },
+ });
+ } else {
+ Integrations.update(integration._id, {
+ $set: {
+ enabled: false,
+ },
+ });
+ }
+ } else if (url) {
+ Integrations.insert({
+ enabled: true,
+ type: 'outgoing-webhooks',
+ url: `${url}`,
+ boardId: `${boardId}`,
+ });
+ }
+ Popup.close();
+ },
+ }];
+ },
+}).register('outgoingWebhooksPopup');