mirror of
https://github.com/flarum/framework.git
synced 2024-12-13 07:03:35 +08:00
Don't display notifications with deleted subjects
This commit is contained in:
parent
c2771abeaa
commit
22d322aa2a
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -227,6 +227,8 @@ export default class Model {
|
|||
|
||||
return relationship && app.store.getById(relationship.data.type, relationship.data.id);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -247,6 +249,8 @@ export default class Model {
|
|||
|
||||
return relationship && relationship.data.map(data => app.store.getById(data.type, data.id));
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,8 @@ abstract class Serializer extends SerializerAbstract
|
|||
} elseif ($many) {
|
||||
$relationIds = $relation.'_ids';
|
||||
$data = isset($model->$relationIds) ? $model->$relationIds : $model->$relation()->lists('id');
|
||||
} else {
|
||||
}
|
||||
if (! $many && empty($data)) {
|
||||
$relationId = $relation.'_id';
|
||||
$data = $model->$relationId;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user