1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

Don't display notifications with deleted subjects

This commit is contained in:
Toby Zerner
2015-07-28 17:15:09 +09:30
parent 8f29949016
commit 97334bea12
4 changed files with 10 additions and 4 deletions

View File

@@ -33,12 +33,14 @@ export default class NotificationList extends Component {
app.cache.notifications.forEach(notification => {
const subject = notification.subject();
if (typeof subject === 'undefined') return;
// Get the discussion that this notification is related to. If it's not
// directly related to a discussion, it may be related to a post or
// other entity which is related to a discussion.
let discussion;
let discussion = false;
if (subject instanceof Discussion) discussion = subject;
else if (subject.discussion) discussion = subject.discussion();
else if (subject && subject.discussion) discussion = subject.discussion();
// If the notification is not related to a discussion directly or
// indirectly, then we will assign it to a neutral group.

View File

@@ -1,6 +1,5 @@
import Component from 'flarum/Component';
import humanTime from 'flarum/helpers/humanTime';
import username from 'flarum/helpers/username';
/**
* Displays information about a the first or last post in a discussion.