浏览代码

Add setting CARD_OPENED_WEBHOOK_ENABLED=false as default.

Thanks to xet7 !

Related https://github.com/wekan/wekan/commit/843478ac40b7718f1096a75295522487f0ca6dbe ,
related #2518
Lauri Ojansivu 5 年之前
父节点
当前提交
b8c527d52b

+ 1 - 0
Dockerfile

@@ -22,6 +22,7 @@ ENV BUILD_DEPS="apt-utils bsdtar gnupg gosu wget curl bzip2 g++ build-essential
     ACCOUNTS_LOCKOUT_UNKNOWN_USERS_LOCKOUT_PERIOD=60 \
     ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW=15 \
     RICHER_CARD_COMMENT_EDITOR=true \
+    CARD_OPENED_WEBHOOK_ENABLED=false \
     ATTACHMENTS_STORE_PATH="" \
     MAX_IMAGE_PIXEL="" \
     IMAGE_COMPRESS_RATIO="" \

+ 29 - 27
client/components/cards/cardDetails.js

@@ -117,34 +117,36 @@ BlazeComponent.extendComponent({
   },
 
   onRendered() {
-    // Send Webhook but not create Activities records ---
-    const card = this.currentData();
-    const userId = Meteor.userId();
-    //console.log(`userId: ${userId}`);
-    //console.log(`cardId: ${card._id}`);
-    //console.log(`boardId: ${card.boardId}`);
-    //console.log(`listId: ${card.listId}`);
-    //console.log(`swimlaneId: ${card.swimlaneId}`);
-    const params = {
-      userId,
-      cardId: card._id,
-      boardId: card.boardId,
-      listId: card.listId,
-      user: Meteor.user().username,
-      url: '',
-    };
-    //console.log('looking for integrations...');
-    const integrations = Integrations.find({
-      boardId: card.boardId,
-      type: 'outgoing-webhooks',
-      enabled: true,
-      activities: { $in: ['CardDetailsRendered', 'all'] },
-    }).fetch();
-    //console.log(`Investigation length: ${integrations.length}`);
-    if (integrations.length > 0) {
-      Meteor.call('outgoingWebhooks', integrations, 'CardSelected', params);
+    if (Meteor.settings.public.CARD_OPENED_WEBHOOK_ENABLED) {
+      // Send Webhook but not create Activities records ---
+      const card = this.currentData();
+      const userId = Meteor.userId();
+      //console.log(`userId: ${userId}`);
+      //console.log(`cardId: ${card._id}`);
+      //console.log(`boardId: ${card.boardId}`);
+      //console.log(`listId: ${card.listId}`);
+      //console.log(`swimlaneId: ${card.swimlaneId}`);
+      const params = {
+        userId,
+        cardId: card._id,
+        boardId: card.boardId,
+        listId: card.listId,
+        user: Meteor.user().username,
+        url: '',
+      };
+      //console.log('looking for integrations...');
+      const integrations = Integrations.find({
+        boardId: card.boardId,
+        type: 'outgoing-webhooks',
+        enabled: true,
+        activities: { $in: ['CardDetailsRendered', 'all'] },
+      }).fetch();
+      //console.log(`Investigation length: ${integrations.length}`);
+      if (integrations.length > 0) {
+        Meteor.call('outgoingWebhooks', integrations, 'CardSelected', params);
+      }
+      //-------------
     }
-    //-------------
 
     if (!Utils.isMiniScreen()) {
       Meteor.setTimeout(() => {

+ 4 - 0
docker-compose.yml

@@ -240,6 +240,10 @@ services:
       # https://github.com/wekan/wekan/pull/2560
       - RICHER_CARD_COMMENT_EDITOR=true
       #---------------------------------------------------------------
+      # ==== CARD OPENED, SEND WEBHOOK MESSAGE ====
+      # https://github.com/wekan/wekan/issues/2518
+      - CARD_OPENED_WEBHOOK_ENABLED=false
+      #---------------------------------------------------------------
       # ==== Allow to shrink attached/pasted image ====
       # https://github.com/wekan/wekan/pull/2544
       #-MAX_IMAGE_PIXEL=1024

+ 3 - 0
releases/virtualbox/start-wekan.sh

@@ -40,6 +40,9 @@
         # https://github.com/wekan/wekan/pull/2560
         export RICHER_CARD_COMMENT_EDITOR=true
         #---------------------------------------------------------------
+        # ==== CARD OPENED, SEND WEBHOOK MESSAGE ====
+        export CARD_OPENED_WEBHOOK_ENABLED=false
+        #---------------------------------------------------------------
         # ==== Allow to shrink attached/pasted image ====
         # https://github.com/wekan/wekan/pull/2544
         #export MAX_IMAGE_PIXEL=1024

+ 5 - 0
server/card-opened-webhook.js

@@ -0,0 +1,5 @@
+Meteor.startup(() => {
+  if (process.env.CARD_OPENED_WEBHOOK_ENABLED) {
+    Meteor.settings.public.CARD_OPENED_WEBHOOK_ENABLED = true;
+  }
+});

文件差异内容过多而无法显示
+ 0 - 0
snap-src/bin/config


+ 6 - 0
snap-src/bin/wekan-help

@@ -69,6 +69,12 @@ echo -e "\t$ snap set $SNAP_NAME richer-card-comment-editor='true'"
 echo -e "Disabled:"
 echo -e "\t$ snap set $SNAP_NAME richer-card-comment-editor='false'"
 echo -e "\n"
+echo -e "Card opened, send webhook message. Default: false https://github.com/wekan/wekan/issues/2518"
+echo -e "Enable:"
+echo -e "\t$ snap set $SNAP_NAME card-opened-webhook-enabled='true'"
+echo -e "Disable, default:"
+echo -e "\t$ snap set $SNAP_NAME card-opened-webhook-enabled='false'"
+echo -e "\n"
 echo -e "Max image pixel: Allow to shrink attached/pasted image https://github.com/wekan/wekan/pull/2544"
 echo -e "Example:"
 echo -e "\t$ snap set $SNAP_NAME max-image-pixel='1024'"

+ 3 - 0
start-wekan.bat

@@ -25,6 +25,9 @@ REM # ==== RICH TEXT EDITOR IN CARD COMMENTS ====
 REM # https://github.com/wekan/wekan/pull/2560
 SET RICHER_CARD_COMMENT_EDITOR=true
 
+REM # ==== CARD OPENED, SEND WEBHOOK MESSAGE ====
+SET CARD_OPENED_WEBHOOK_ENABLED=false
+
 REM # ==== Allow to shrink attached/pasted image ====
 REM # https://github.com/wekan/wekan/pull/2544
 REM SET MAX_IMAGE_PIXEL=1024

+ 3 - 0
start-wekan.sh

@@ -41,6 +41,9 @@
       # https://github.com/wekan/wekan/pull/2560
       export RICHER_CARD_COMMENT_EDITOR=true
       #---------------------------------------------------------------
+      # ==== CARD OPENED, SEND WEBHOOK MESSAGE ====
+      export CARD_OPENED_WEBHOOK_ENABLED=false
+      #---------------------------------------------------------------
       # ==== Allow to shrink attached/pasted image ====
       # https://github.com/wekan/wekan/pull/2544
       #export MAX_IMAGE_PIXEL=1024

部分文件因为文件数量过多而无法显示