mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08: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:
parent
8a5a3a0624
commit
394ae32657
|
@ -24,6 +24,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
### Fixed
|
||||
- Output forum description in meta description tag. ([#506](https://github.com/flarum/core/issues/506))
|
||||
- Allow users to edit their last post in a discussion even if it's hidden.
|
||||
- Allow users to rename their discussion even if their first post is hidden.
|
||||
- Fix several design bugs.
|
||||
|
||||
## [0.1.0-beta.2] - 2015-09-15
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user