mirror of
https://github.com/flarum/framework.git
synced 2024-11-23 23:45:17 +08:00
Fix bug in permission logic
This commit is contained in:
parent
4282b9be20
commit
cbab23a3f5
|
@ -32,8 +32,9 @@ class UnapproveNewContent
|
|||
$post = $event->post;
|
||||
|
||||
if (! $post->exists) {
|
||||
if (($post->discussion->number_index == 0 && $event->actor->can('startWithoutApproval', $post->discussion))
|
||||
|| $event->actor->can('replyWithoutApproval', $post->discussion)) {
|
||||
$ability = $post->discussion->number_index == 0 ? 'startWithoutApproval' : 'replyWithoutApproval';
|
||||
|
||||
if ($event->actor->can($ability, $post->discussion)) {
|
||||
if ($post->is_approved === null) {
|
||||
$post->is_approved = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user