浏览代码

Merge pull request #5205 from gustavengstrom/master

Updated swimlane (restore and changed title) and board (changed title) webhooks
Lauri Ojansivu 1 年之前
父节点
当前提交
fae5f6d64a
共有 3 个文件被更改,包括 41 次插入6 次删除
  1. 1 1
      docker-compose.yml
  2. 12 2
      models/boards.js
  3. 28 3
      models/swimlanes.js

+ 1 - 1
docker-compose.yml

@@ -368,7 +368,7 @@ services:
       #-----------------------------------------------------------------
       # ==== OUTGOING WEBHOOKS ====
       # What to send to Outgoing Webhook, or leave out. If commented out the default values will be: cardId,listId,oldListId,boardId,comment,user,card,commentId,swimlaneId,customerField,customFieldValue
-      #- WEBHOOKS_ATTRIBUTES=cardId,listId,oldListId,boardId,comment,user,card,commentId
+      #- WEBHOOKS_ATTRIBUTES=cardId,listId,oldListId,boardId,comment,user,card,board,list,swimlane,commentId
       #-----------------------------------------------------------------
       # ==== Debug OIDC OAuth2 etc ====
       #- DEBUG=true

+ 12 - 2
models/boards.js

@@ -1845,7 +1845,6 @@ if (Meteor.isServer) {
     if (!_.contains(fieldNames, 'members')) {
       return;
     }
-
     if (modifier.$set) {
       const boardId = doc._id;
       foreachRemovedMember(doc, modifier.$set, memberId => {
@@ -1899,10 +1898,21 @@ if (Meteor.isServer) {
 
   // Add a new activity if we add or remove a member to the board
   Boards.after.update((userId, doc, fieldNames, modifier) => {
+    console.log('board',doc)
+    if (fieldNames.includes('title')) {
+      Activities.insert({
+        userId,
+        type: 'board',
+        activityType: 'changedBoardTitle',
+        boardId: doc._id,
+        // this preserves the name so that the activity can be useful after the
+        // list is deleted
+        title: doc.title,
+      });
+    }
     if (!_.contains(fieldNames, 'members')) {
       return;
     }
-
     // Say hello to the new member
     if (modifier.$push && modifier.$push.members) {
       const memberId = modifier.$push.members.userId;

+ 28 - 3
models/swimlanes.js

@@ -371,14 +371,39 @@ if (Meteor.isServer) {
     });
   });
 
-  Swimlanes.after.update((userId, doc) => {
-    if (doc.archived) {
+  Swimlanes.after.update((userId, doc, fieldNames) => {
+    if (fieldNames.includes('title')) {
+      Activities.insert({
+        userId,
+        type: 'swimlane',
+        activityType: 'changedSwimlaneTitle',
+        listId: doc._id,
+        boardId: doc.boardId,
+        // this preserves the name so that the activity can be useful after the
+        // list is deleted
+        title: doc.title,
+      });
+    } else if (doc.archived)  {
       Activities.insert({
         userId,
         type: 'swimlane',
         activityType: 'archivedSwimlane',
-        swimlaneId: doc._id,
+        listId: doc._id,
+        boardId: doc.boardId,
+        // this preserves the name so that the activity can be useful after the
+        // list is deleted
+        title: doc.title,
+      });
+    } else if (fieldNames.includes('archived'))  {
+      Activities.insert({
+        userId,
+        type: 'swimlane',
+        activityType: 'restoredSwimlane',
+        listId: doc._id,
         boardId: doc.boardId,
+        // this preserves the name so that the activity can be useful after the
+        // list is deleted
+        title: doc.title,
       });
     }
   });