mirror of
https://github.com/wekan/wekan.git
synced 2026-01-04 00:28:49 +01:00
use ReactiveMiniMongoIndex for notifications
This commit is contained in:
parent
402528d97e
commit
c4882707e9
2 changed files with 24 additions and 2 deletions
|
|
@ -1410,6 +1410,28 @@ ReactiveMiniMongoIndex = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
},
|
||||||
|
getActivityWithId(activityId, addSelect = {}, options) {
|
||||||
|
let ret = []
|
||||||
|
if (activityId) {
|
||||||
|
const select = {addSelect, options}
|
||||||
|
if (!this.__activityWithId) {
|
||||||
|
this.__activityWithId = new DataCache(_select => {
|
||||||
|
const __select = EJSON.parse(_select);
|
||||||
|
const _activities = ReactiveCache.getActivities(
|
||||||
|
{ _id: { $exists: true },
|
||||||
|
...__select.addSelect,
|
||||||
|
}, __select.options);
|
||||||
|
const _ret = _.indexBy(_activities, '_id')
|
||||||
|
return _ret;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ret = this.__activityWithId.get(EJSON.stringify(select));
|
||||||
|
if (ret) {
|
||||||
|
ret = ret[activityId];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { ReactiveCache } from '/imports/reactiveCache';
|
import { ReactiveCache, ReactiveMiniMongoIndex } from '/imports/reactiveCache';
|
||||||
import { SyncedCron } from 'meteor/percolate:synced-cron';
|
import { SyncedCron } from 'meteor/percolate:synced-cron';
|
||||||
import { TAPi18n } from '/imports/i18n';
|
import { TAPi18n } from '/imports/i18n';
|
||||||
import ImpersonatedUsers from './impersonatedUsers';
|
import ImpersonatedUsers from './impersonatedUsers';
|
||||||
|
|
@ -853,7 +853,7 @@ Users.helpers({
|
||||||
// this preserves their db sort order for editing
|
// this preserves their db sort order for editing
|
||||||
notification.dbIndex = index;
|
notification.dbIndex = index;
|
||||||
if (!notification.activityObj && typeof(notification.activity) === 'string') {
|
if (!notification.activityObj && typeof(notification.activity) === 'string') {
|
||||||
notification.activityObj = ReactiveCache.getActivity(notification.activity);
|
notification.activityObj = ReactiveMiniMongoIndex.getActivityWithId(notification.activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this sorts them newest to oldest to match Trello's behavior
|
// this sorts them newest to oldest to match Trello's behavior
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue