mirror of
https://github.com/wekan/wekan.git
synced 2025-12-21 01:40:13 +01:00
Merge pull request #5189 from mfilser/notifications_are_now_displayed_correctly_again
Notifications are now displayed correctly again
This commit is contained in:
commit
fe6b94e539
3 changed files with 30 additions and 6 deletions
|
|
@ -11,7 +11,7 @@ template(name='notificationsDrawer')
|
||||||
a.fa.fa-times-thin.close
|
a.fa.fa-times-thin.close
|
||||||
ul.notifications
|
ul.notifications
|
||||||
each transformedProfile.notifications
|
each transformedProfile.notifications
|
||||||
+notification(activityData=activity index=dbIndex read=read)
|
+notification(activityData=activityObj index=dbIndex read=read)
|
||||||
if($gt unreadNotifications 0)
|
if($gt unreadNotifications 0)
|
||||||
a.all-read {{_ 'mark-all-as-read'}}
|
a.all-read {{_ 'mark-all-as-read'}}
|
||||||
if ($and ($.Session.get 'showReadNotifications') ($gt readNotifications 0))
|
if ($and ($.Session.get 'showReadNotifications') ($gt readNotifications 0))
|
||||||
|
|
|
||||||
|
|
@ -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';
|
||||||
|
|
@ -852,11 +852,13 @@ Users.helpers({
|
||||||
const notification = notifications[index];
|
const notification = notifications[index];
|
||||||
// this preserves their db sort order for editing
|
// this preserves their db sort order for editing
|
||||||
notification.dbIndex = index;
|
notification.dbIndex = index;
|
||||||
notification.activity = ReactiveCache.getActivity(notification.activity);
|
if (!notification.activityObj && typeof(notification.activity) === 'string') {
|
||||||
|
notification.activityObj = ReactiveMiniMongoIndex.getActivityWithId(notification.activity);
|
||||||
}
|
}
|
||||||
// this sorts them newest to oldest to match Trello's behavior
|
}
|
||||||
notifications.reverse();
|
// newest first. don't use reverse() because it changes the array inplace, so sometimes the array is reversed twice and oldest items at top again
|
||||||
return notifications;
|
const ret = notifications.toReversed();
|
||||||
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
hasShowDesktopDragHandles() {
|
hasShowDesktopDragHandles() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue