소스 검색

Added restore swimlane and swimlane title to webhooks

Gustav Engström 1 년 전
부모
커밋
832bd6187c
1개의 변경된 파일28개의 추가작업 그리고 3개의 파일을 삭제
  1. 28 3
      models/swimlanes.js

+ 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,
       });
     }
   });