/** * @param \Flarum\Event\DiscussionWasRenamed $event */ public function whenDiscussionWasRenamed(DiscussionWasRenamed $event) { $post = DiscussionRenamedPost::reply($event->discussion->id, $event->actor->id, $event->oldTitle, $event->discussion->title); $post = $event->discussion->mergePost($post); if ($event->discussion->start_user_id !== $event->actor->id) { $blueprint = new DiscussionRenamedBlueprint($post); if ($post->exists) { $this->notifications->sync($blueprint, [$event->discussion->startUser]); } else { $this->notifications->delete($blueprint); } } }
/** * @param PostWasDeleted $event */ public function whenPostWasDeleted(PostWasDeleted $event) { $this->notifications->delete($this->getNotification($event->post)); }