summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/activities/activities.jade11
-rw-r--r--i18n/en.i18n.json1
-rw-r--r--models/activities.js3
-rw-r--r--models/checklists.js23
4 files changed, 28 insertions, 10 deletions
diff --git a/client/components/activities/activities.jade b/client/components/activities/activities.jade
index fad147fc..be12a728 100644
--- a/client/components/activities/activities.jade
+++ b/client/components/activities/activities.jade
@@ -31,6 +31,12 @@ template(name="boardActivities")
.activity-checklist(href="{{ card.absoluteUrl }}")
+viewer
= checklist.title
+
+ if($eq activityType 'addChecklistItem')
+ | {{{_ 'activity-checklist-item-added' checklist.title cardLink}}}.
+ .activity-checklist(href="{{ card.absoluteUrl }}")
+ +viewer
+ = checklistItem.title
if($eq activityType 'archivedCard')
| {{{_ 'activity-archived' cardLink}}}.
@@ -117,6 +123,11 @@ template(name="cardActivities")
.activity-checklist
+viewer
= checklist.title
+ if($eq activityType 'addChecklistItem')
+ | {{{_ 'activity-checklist-item-added' checklist.title cardLink}}}.
+ .activity-checklist(href="{{ card.absoluteUrl }}")
+ +viewer
+ = checklistItem.title
if($eq activityType 'addComment')
+inlinedForm(classNames='js-edit-comment')
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index da47e1c6..e8062f71 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -37,6 +37,7 @@
"activity-sent": "sent %s to %s",
"activity-unjoined": "unjoined %s",
"activity-checklist-added": "added checklist to %s",
+ "activity-checklist-item-added": "added checklist item to '%s' in %s",
"add": "Add",
"add-attachment": "Add Attachment",
"add-board": "Add Board",
diff --git a/models/activities.js b/models/activities.js
index f1e52493..b7fbc61b 100644
--- a/models/activities.js
+++ b/models/activities.js
@@ -38,6 +38,9 @@ Activities.helpers({
checklist() {
return Checklists.findOne(this.checklistId);
},
+ checklistItem() {
+ return Checklists.findOne(this.checklistId).getItem(this.checklistItemId);
+ },
});
Activities.before.insert((userId, doc) => {
diff --git a/models/checklists.js b/models/checklists.js
index 0ee62fa2..ab4fe61d 100644
--- a/models/checklists.js
+++ b/models/checklists.js
@@ -161,16 +161,19 @@ if (Meteor.isServer) {
});
//TODO: so there will be no activity for adding item into checklist, maybe will be implemented in the future.
- // Checklists.after.update((userId, doc) => {
- // console.log('update:', doc)
- // Activities.insert({
- // userId,
- // activityType: 'addChecklist',
- // boardId: doc.boardId,
- // cardId: doc.cardId,
- // checklistId: doc._id,
- // });
- // });
+ // The future is now
+ Checklists.after.update((userId, doc, fieldNames, modifier) => {
+ if (fieldNames.includes('items')) {
+ Activities.insert({
+ userId,
+ activityType: 'addChecklistItem',
+ cardId: doc.cardId,
+ boardId: Cards.findOne(doc.cardId).boardId,
+ checklistId: doc._id,
+ checklistItemId: modifier.$addToSet.items._id,
+ });
+ }
+ });
Checklists.before.remove((userId, doc) => {
const activity = Activities.findOne({ checklistId: doc._id });