summaryrefslogtreecommitdiffstats
path: root/models/activities.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/activities.js')
-rw-r--r--models/activities.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/models/activities.js b/models/activities.js
index ad920149..7d262ec6 100644
--- a/models/activities.js
+++ b/models/activities.js
@@ -35,18 +35,23 @@ Activities.helpers({
attachment() {
return Attachments.findOne(this.attachmentId);
},
+ checklist() {
+ return Checklists.findOne(this.checklistId);
+ },
});
Activities.before.insert((userId, doc) => {
doc.createdAt = new Date();
});
-// For efficiency create an index on the date of creation.
if (Meteor.isServer) {
+ // For efficiency create indexes on the date of creation, and on the date of
+ // creation in conjunction with the card or board id, as corresponding views
+ // are largely used in the App. See #524.
Meteor.startup(() => {
- Activities._collection._ensureIndex({
- createdAt: -1,
- });
+ Activities._collection._ensureIndex({ createdAt: -1 });
+ Activities._collection._ensureIndex({ cardId: 1, createdAt: -1 });
+ Activities._collection._ensureIndex({ boardId: 1, createdAt: -1 });
});
Activities.after.insert((userId, doc) => {
@@ -100,6 +105,10 @@ if (Meteor.isServer) {
const attachment = activity.attachment();
params.attachment = attachment._id;
}
+ if (activity.checklistId) {
+ const checklist = activity.checklist();
+ params.checklist = checklist.title;
+ }
if (board) {
const watchingUsers = _.pluck(_.where(board.watchers, {level: 'watching'}), 'userId');
const trackingUsers = _.pluck(_.where(board.watchers, {level: 'tracking'}), 'userId');