mirror of
https://github.com/flarum/framework.git
synced 2025-01-20 21:06:14 +08:00
Don't allow guests to alter subscription
This commit is contained in:
parent
74fdf7b79c
commit
98369acd70
|
@ -1,6 +1,7 @@
|
|||
<?php namespace Flarum\Subscriptions\Listeners;
|
||||
|
||||
use Flarum\Events\DiscussionWillBeSaved;
|
||||
use Flarum\Core\Exceptions\PermissionDeniedException;
|
||||
|
||||
class PersistSubscriptionData
|
||||
{
|
||||
|
@ -18,6 +19,10 @@ class PersistSubscriptionData
|
|||
$actor = $event->actor;
|
||||
$subscription = $data['attributes']['subscription'];
|
||||
|
||||
if (! $actor->exists) {
|
||||
throw new PermissionDeniedException;
|
||||
}
|
||||
|
||||
$state = $discussion->stateFor($actor);
|
||||
|
||||
if (! in_array($subscription, ['follow', 'ignore'])) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user