瀏覽代碼

[Add more Webhook translations](https://github.com/wekan/wekan/issues/1969).
In progress.

Thanks to xet7 !

Related #1969

Lauri Ojansivu 6 年之前
父節點
當前提交
3bfc6ea8d7
共有 3 個文件被更改,包括 59 次插入21 次删除
  1. 29 20
      i18n/en.i18n.json
  2. 29 0
      models/activities.js
  3. 1 1
      server/notifications/outgoing.js

+ 29 - 20
i18n/en.i18n.json

@@ -1,28 +1,37 @@
 {
     "accept": "Accept",
     "act-activity-notify": "Activity Notification",
-    "act-addAttachment": "attached __attachment__ to __card__",
-    "act-addSubtask": "added subtask __checklist__ to __card__",
-    "act-addChecklist": "added checklist __checklist__ to __card__",
-    "act-addChecklistItem": "added __checklistItem__ to checklist __checklist__ on __card__",
-    "act-addComment": "commented on __card__: __comment__",
-    "act-createBoard": "created __board__",
-    "act-createCard": "added __card__ to __list__",
-    "act-createCustomField": "created custom field __customField__",
+    "act-addAttachment": "added attachment __attachment__ to card __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-deleteAttachment": "deleted attachment __attachment__ at card __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-addSubtask": "added subtask __checklist__ to __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-addLabel": "Added label __label__ to __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-removeLabel": "Removed label __label__ from __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-addChecklist": "added checklist __checklist__ to __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-addChecklistItem": "added checklist item __checklistItem__ to checklist __checklist__ on __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-removeChecklist": "removed checklist __checklist__ from __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-removeChecklistItem": "removed checklist item __checklistItem__ from checklist __checkList__ at __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-checkedItem": "checked __checklistItem__ in checklist __checklist__ of card __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-uncheckedItem": "unchecked __checklistItem__ in checklist __checklist__ of card __card__ at list __list__ at at swimlane __swimlane__ at board __board__",
+    "act-completeChecklist": "completed checklist __checklist__ of card __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-uncompleteChecklist": "uncompleted checklist __checklist__ of card __card__ at list __list__ swimlane __swimlane__ at board __board__",
+    "act-addComment": "commented on __card__: __comment__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-createBoard": "created board __board__",
+    "act-createCard": "created card __card__ to __list__ at swimlane __swimlane__ at board __board__",
+    "act-createCustomField": "created custom field __customField__ to card __card__ at list __list__ at swimlane __swimlane__ at board __board__",
     "act-createList": "added __list__ to __board__",
     "act-addBoardMember": "added __member__ to __board__",
-    "act-archivedBoard": "__board__ moved to Archive",
-    "act-archivedCard": "__card__ moved to Archive",
-    "act-archivedList": "__list__ moved to Archive",
-    "act-archivedSwimlane": "__swimlane__ moved to Archive",
+    "act-archivedBoard": "Board __board__ moved to Archive",
+    "act-archivedCard": "Card __card__ at list __list__ at swimlane __swimlane__ at board __board__ moved to Archive",
+    "act-archivedList": "List __list__ at swimlane __swimlane__ at board __board__ moved to Archive",
+    "act-archivedSwimlane": "Swimlane __swimlane__ at board __board__ moved to Archive",
     "act-importBoard": "imported __board__",
-    "act-importCard": "imported __card__",
-    "act-importList": "imported __list__",
-    "act-joinMember": "added __member__ to __card__",
-    "act-moveCard": "moved __card__ from __oldList__ to __list__",
+    "act-importCard": "imported __card__ to list __list__ at swimlane __swimlane__ at board __board__",
+    "act-importList": "imported __list__ to swimlane __swimlane__ at board __board__",
+    "act-joinMember": "added __member__ to __card__ at list __list__ at swimlane __swimlane__ at board __board__",
+    "act-moveCard": "moved card __card__ from list __oldList__ at swimlane __oldSwimlane__ at board __oldBoard__ to list __list__ at swimlane __swimlane__ at board __board__",
     "act-removeBoardMember": "removed __member__ from __board__",
-    "act-restoredCard": "restored __card__ to __board__",
-    "act-unjoinMember": "removed __member__ from __card__",
+    "act-restoredCard": "restored __card__ to list __list__ at swimlane __swimlane__ at board __board__",
+    "act-unjoinMember": "removed __member__ from __card__ at list __list__ at swimlane __swimlane__ at board __board__",
     "act-withBoardTitle": "__board__",
     "act-withCardTitle": "[__board__] __card__",
     "actions": "Actions",
@@ -47,14 +56,14 @@
     "activity-unchecked-item": "unchecked %s in checklist %s of %s",
     "activity-checklist-added": "added checklist to %s",
     "activity-checklist-removed": "removed a checklist from %s",
-    "activity-checklist-completed": "completed the checklist %s of %s",
+    "activity-checklist-completed": "completed the checklist __checklist__ of card __card__ at swimlane __swimlane__ of board __board__",
     "activity-checklist-uncompleted": "uncompleted the checklist %s of %s",
     "activity-checklist-item-added": "added checklist item to '%s' in %s",
     "activity-checklist-item-removed": "removed a checklist item from '%s' in %s",
     "add": "Add",
     "activity-checked-item-card": "checked %s in checklist %s",
     "activity-unchecked-item-card": "unchecked %s in checklist %s",
-    "activity-checklist-completed-card": "completed the checklist %s",
+    "activity-checklist-completed-card": "completed the checklist __checklist__ of card __card__ at swimlane __swimlane__ of board __board__",
     "activity-checklist-uncompleted-card": "uncompleted the checklist %s",
     "add-attachment": "Add Attachment",
     "add-board": "Add Board",

+ 29 - 0
models/activities.js

@@ -14,6 +14,9 @@ Activities.helpers({
   board() {
     return Boards.findOne(this.boardId);
   },
+  oldBoard() {
+    return Boards.findOne(this.oldBoardId);
+  },
   user() {
     return Users.findOne(this.userId);
   },
@@ -26,6 +29,9 @@ Activities.helpers({
   swimlane() {
     return Swimlanes.findOne(this.swimlaneId);
   },
+  oldSwimlane() {
+    return Swimlanes.findOne(this.oldSwimlaneId);
+  },
   oldList() {
     return Lists.findOne(this.oldListId);
   },
@@ -50,6 +56,9 @@ Activities.helpers({
   customField() {
     return CustomFields.findOne(this.customFieldId);
   },
+  label() {
+    return Labels.findOne(this.labelId);
+  },
 });
 
 Activities.before.insert((userId, doc) => {
@@ -75,6 +84,7 @@ if (Meteor.isServer) {
     Activities._collection._ensureIndex({ commentId: 1 }, { partialFilterExpression: { commentId: { $exists: true } } });
     Activities._collection._ensureIndex({ attachmentId: 1 }, { partialFilterExpression: { attachmentId: { $exists: true } } });
     Activities._collection._ensureIndex({ customFieldId: 1 }, { partialFilterExpression: { customFieldId: { $exists: true } } });
+    Activities._collection._ensureIndex({ labelId: 1 }, { partialFilterExpression: { labelId: { $exists: true } } });
   });
 
   Activities.after.insert((userId, doc) => {
@@ -100,6 +110,12 @@ if (Meteor.isServer) {
       params.url = board.absoluteUrl();
       params.boardId = activity.boardId;
     }
+    if (activity.oldBoardId) {
+      const oldBoard = activity.oldBoard();
+      watchers = _.union(watchers, oldBoard.watchers || []);
+      params.oldBoard = oldBoard.title;
+      params.oldBoardId = activity.oldBoardId;
+    }
     if (activity.memberId) {
       participants = _.union(participants, [activity.memberId]);
       params.member = activity.member().getName();
@@ -116,6 +132,12 @@ if (Meteor.isServer) {
       params.oldList = oldList.title;
       params.oldListId = activity.oldListId;
     }
+    if (activity.oldSwimlaneId) {
+      const oldSwimlane = activity.oldSwimlane();
+      watchers = _.union(watchers, oldSwimlane.watchers || []);
+      params.oldSwimlane = oldSwimlane.title;
+      params.oldSwimlaneId = activity.oldSwimlaneId;
+    }
     if (activity.cardId) {
       const card = activity.card();
       participants = _.union(participants, [card.userId], card.members || []);
@@ -126,6 +148,8 @@ if (Meteor.isServer) {
       params.cardId = activity.cardId;
     }
     if (activity.swimlaneId) {
+      const swimlane = activity.swimlane();
+      params.swimlane = swimlane.title;
       params.swimlaneId = activity.swimlaneId;
     }
     if (activity.commentId) {
@@ -149,6 +173,11 @@ if (Meteor.isServer) {
       const customField = activity.customField();
       params.customField = customField.name;
     }
+    if (activity.labelId) {
+      const label = activity.label();
+      params.label = label.name;
+      params.labelId = activity.labelId;
+    }
     if (board) {
       const watchingUsers = _.pluck(_.where(board.watchers, {level: 'watching'}), 'userId');
       const trackingUsers = _.pluck(_.where(board.watchers, {level: 'tracking'}), 'userId');

+ 1 - 1
server/notifications/outgoing.js

@@ -17,7 +17,7 @@ Meteor.methods({
     check(params, Object);
 
     const quoteParams = _.clone(params);
-    ['card', 'list', 'oldList', 'board', 'comment'].forEach((key) => {
+    ['card', 'list', 'oldList', 'board', 'oldBoard', 'comment', 'checklist', 'label', 'swimlane', 'oldSwimlane'].forEach((key) => {
       if (quoteParams[key]) quoteParams[key] = `"${params[key]}"`;
     });