mirror of
https://github.com/flarum/core.git
synced 2025-10-23 04:36:08 +02:00
went over most of the changed attributes from the other pr
This commit is contained in:
@@ -81,7 +81,7 @@ class PostPolicy extends AbstractPolicy
|
||||
// discussion.
|
||||
if (! $actor->hasPermission('discussion.editPosts')) {
|
||||
$query->where(function ($query) use ($actor) {
|
||||
$query->whereNull('posts.hide_time')
|
||||
$query->whereNull('posts.hidden_at')
|
||||
->orWhere('user_id', $actor->id)
|
||||
->orWhereExists(function ($query) use ($actor) {
|
||||
$query->selectRaw('1')
|
||||
@@ -107,12 +107,12 @@ class PostPolicy extends AbstractPolicy
|
||||
// A post is allowed to be edited if the user has permission to moderate
|
||||
// the discussion which it's in, or if they are the author and the post
|
||||
// hasn't been deleted by someone else.
|
||||
if ($post->user_id == $actor->id && (! $post->hide_time || $post->hide_user_id == $actor->id)) {
|
||||
if ($post->user_id == $actor->id && (! $post->hidden_at || $post->hidden_user_id == $actor->id)) {
|
||||
$allowEditing = $this->settings->get('allow_post_editing');
|
||||
|
||||
if ($allowEditing === '-1'
|
||||
|| ($allowEditing === 'reply' && $post->number >= $post->discussion->last_post_number)
|
||||
|| ($post->time->diffInMinutes(new Carbon) < $allowEditing)) {
|
||||
|| ($post->created_at->diffInMinutes(new Carbon) < $allowEditing)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user