Update old attribute names. fixes flarum/core#1666

This commit is contained in:
Toby Zerner 2018-12-04 09:18:01 +10:30
parent 3e6fb78c1e
commit b8661a166f

View File

@ -113,13 +113,13 @@ app.initializers.add('flarum-pusher', () => {
const id = String(data.discussionId); const id = String(data.discussionId);
if (this.discussion && this.discussion.id() === id && this.stream) { if (this.discussion && this.discussion.id() === id && this.stream) {
const oldCount = this.discussion.commentsCount(); const oldCount = this.discussion.commentCount();
app.store.find('discussions', this.discussion.id()).then(() => { app.store.find('discussions', this.discussion.id()).then(() => {
this.stream.update(); this.stream.update();
if (!document.hasFocus()) { if (!document.hasFocus()) {
app.setTitleCount(Math.max(0, this.discussion.commentsCount() - oldCount)); app.setTitleCount(Math.max(0, this.discussion.commentCount() - oldCount));
$(window).one('focus', () => app.setTitleCount(0)); $(window).one('focus', () => app.setTitleCount(0));
} }
@ -139,8 +139,8 @@ app.initializers.add('flarum-pusher', () => {
if (channels.user) { if (channels.user) {
channels.user.bind('notification', () => { channels.user.bind('notification', () => {
app.session.user.pushAttributes({ app.session.user.pushAttributes({
unreadNotificationsCount: app.session.user.unreadNotificationsCount() + 1, unreadNotificationCount: app.session.user.unreadNotificationCount() + 1,
newNotificationsCount: app.session.user.newNotificationsCount() + 1 newNotificationCount: app.session.user.newNotificationCount() + 1
}); });
delete app.cache.notifications; delete app.cache.notifications;
m.redraw(); m.redraw();