mirror of
https://github.com/flarum/core.git
synced 2025-10-20 03:06:07 +02:00
Delete associated notifications when deleting discussions, posts, and users. fixes #1380
This commit is contained in:
@@ -17,6 +17,7 @@ use Flarum\Discussion\Discussion;
|
||||
use Flarum\Event\GetModelIsPrivate;
|
||||
use Flarum\Event\ScopeModelVisibility;
|
||||
use Flarum\Foundation\EventGeneratorTrait;
|
||||
use Flarum\Notification\Notification;
|
||||
use Flarum\Post\Event\Deleted;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -106,6 +107,8 @@ class Post extends AbstractModel
|
||||
|
||||
static::deleted(function (Post $post) {
|
||||
$post->raise(new Deleted($post));
|
||||
|
||||
Notification::whereSubject($post)->delete();
|
||||
});
|
||||
|
||||
static::addGlobalScope(new RegisteredTypesScope);
|
||||
|
Reference in New Issue
Block a user