1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 16:36:47 +02:00

Relax self edit/rename restrictions

- Fixes the last post not being self-editable if it's hidden
- Fixes the discussion not being self-renameable its only post is hidden
This commit is contained in:
Toby Zerner
2015-09-22 17:56:09 +09:30
parent 5598e885b7
commit 7a0299d246
3 changed files with 5 additions and 2 deletions

View File

@@ -48,7 +48,7 @@ class DiscussionsServiceProvider extends ServiceProvider
$allowRenaming = $settings->get('allow_renaming');
if ($allowRenaming === '-1' ||
($allowRenaming === 'reply' && $event->model->participants_count == 1) ||
($allowRenaming === 'reply' && $event->model->participants_count <= 1) ||
($event->model->start_time->diffInMinutes(Carbon::now()) < $allowRenaming)) {
return true;
}

View File

@@ -55,11 +55,12 @@ class PostsServiceProvider extends ServiceProvider
if ($post->discussion->can($actor, 'editPosts')) {
return true;
}
if ($post->user_id == $actor->id && (! $post->hide_time || $post->hide_user_id == $actor->id)) {
$allowEditing = $settings->get('allow_post_editing');
if ($allowEditing === '-1' ||
($allowEditing === 'reply' && $event->model->number == $event->model->discussion->last_post_number) ||
($allowEditing === 'reply' && $event->model->number >= $event->model->discussion->last_post_number) ||
($event->model->time->diffInMinutes(Carbon::now()) < $allowEditing)) {
return true;
}