mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 17:57:04 +08:00
Remove use of event priorities
Event priorities are no longer in Laravel - see dbbfc62bef
Now we can't force this event listener to be run before the discussion
metadata is updated; instead we just subtract one off of the new
last post number.
This commit is contained in:
parent
14bc69d6bd
commit
c7aeef19ea
|
@ -44,10 +44,7 @@ class SendNotificationWhenReplyIsPosted
|
||||||
{
|
{
|
||||||
$events->listen(ConfigureNotificationTypes::class, [$this, 'addNotificationType']);
|
$events->listen(ConfigureNotificationTypes::class, [$this, 'addNotificationType']);
|
||||||
|
|
||||||
// Register with '1' as priority so this runs before discussion metadata
|
$events->listen(Posted::class, [$this, 'whenPosted']);
|
||||||
// is updated, as we need to compare the user's last read number to that
|
|
||||||
// of the previous post.
|
|
||||||
$events->listen(Posted::class, [$this, 'whenPosted'], 1);
|
|
||||||
$events->listen(Hidden::class, [$this, 'whenHidden']);
|
$events->listen(Hidden::class, [$this, 'whenHidden']);
|
||||||
$events->listen(Restored::class, [$this, 'whenRestored']);
|
$events->listen(Restored::class, [$this, 'whenRestored']);
|
||||||
$events->listen(Deleted::class, [$this, 'whenDeleted']);
|
$events->listen(Deleted::class, [$this, 'whenDeleted']);
|
||||||
|
@ -72,7 +69,7 @@ class SendNotificationWhenReplyIsPosted
|
||||||
$notify = $discussion->readers()
|
$notify = $discussion->readers()
|
||||||
->where('users.id', '!=', $post->user_id)
|
->where('users.id', '!=', $post->user_id)
|
||||||
->where('users_discussions.subscription', 'follow')
|
->where('users_discussions.subscription', 'follow')
|
||||||
->where('users_discussions.read_number', $discussion->last_post_number)
|
->where('users_discussions.read_number', $discussion->last_post_number - 1)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$this->notifications->sync(
|
$this->notifications->sync(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user