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