Skip to content

Commit

Permalink
Fix extension to work with latest state changes
Browse files Browse the repository at this point in the history
  • Loading branch information
franzliedke committed Jun 26, 2020
1 parent 51a765c commit 27b04fc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ app.initializers.add('flarum-pusher', () => {

app.pusher.then(channels => {
channels.main.bind('newPost', data => {
const params = this.props.params;
const params = app.discussions.getParams();

if (!params.q && !params.sort && !params.filter) {
if (params.tags) {
Expand All @@ -46,10 +46,10 @@ app.initializers.add('flarum-pusher', () => {

const id = String(data.discussionId);

if ((!app.current.discussion || id !== app.current.discussion.id()) && app.pushedUpdates.indexOf(id) === -1) {
if ((!app.current.get('discussion') || id !== app.current.get('discussion').id()) && app.pushedUpdates.indexOf(id) === -1) {
app.pushedUpdates.push(id);

if (app.current instanceof IndexPage) {
if (app.current.matches(IndexPage)) {
app.setTitleCount(app.pushedUpdates.length);
}

Expand Down Expand Up @@ -98,7 +98,7 @@ app.initializers.add('flarum-pusher', () => {
app.pushedUpdates.splice(index, 1);
}

if (app.current instanceof IndexPage) {
if (app.current.matches(IndexPage)) {
app.setTitleCount(app.pushedUpdates.length);
}

Expand Down Expand Up @@ -142,7 +142,7 @@ app.initializers.add('flarum-pusher', () => {
unreadNotificationCount: app.session.user.unreadNotificationCount() + 1,
newNotificationCount: app.session.user.newNotificationCount() + 1
});
delete app.cache.notifications;
app.notifications.clear();
m.redraw();
});
}
Expand Down

0 comments on commit 27b04fc

Please sign in to comment.