feat(permission): add delete own posts permission - #3784
Conversation
SychO9
left a comment
There was a problem hiding this comment.
Nice!
One thing I'd like us to make consistent is the key of the permission and locale label. Let's make tem consistent and use allow_hide_own_posts for te permission key AND the label allow_hide_own_posts_label, andeplace any allow_delete_own_posts
| public function hide(User $actor, Post $post) | ||
| { | ||
| return $this->edit($actor, $post); | ||
| if ($post->user_id == $actor->id && (! $post->hidden_at || $post->hidden_user_id == $actor->id) && $actor->can('reply', $post->discussion)) { |
There was a problem hiding this comment.
I wonder if we should drop the bit about only being able to hide when the discussion is still open 🤔
| if ($post->user_id == $actor->id && (! $post->hidden_at || $post->hidden_user_id == $actor->id) && $actor->can('reply', $post->discussion)) { | |
| if ($post->user_id == $actor->id && (! $post->hidden_at || $post->hidden_user_id == $actor->id)) { |
There was a problem hiding this comment.
I tried to keep the behavior close to the post-editing one for consistency so that's why that's there! I was wondering if it would be necessary or not.
There was a problem hiding this comment.
Yeah, not sure, let's keep it as is for now, then we'll see I guess unless other core devs have an opinion on is.
There was a problem hiding this comment.
I'd prefer to keep it. If a user can't participate in a discussion going forward, i don't think they should be able to participate retroactively either.
askvortsov1
left a comment
There was a problem hiding this comment.
Looks good to me, left a few comments though.
| : app.translator.trans('core.admin.permissions_controls.allow_indefinitely_button'), | ||
| key: 'allow_hide_own_posts', | ||
| options: [ | ||
| { value: '-1', label: app.translator.trans('core.admin.permissions_controls.allow_indefinitely_button') }, |
There was a problem hiding this comment.
Perhaps this should be extracted into a util? Although probably not, if we restructure the permissions system during 2.0, that would become redundant.
There was a problem hiding this comment.
I wonder if we will end up restructuring it in 2.0, we need some brainstorming .
Fixes https://discuss.flarum.org/d/31993-adding-permission-to-delete-own-posts
Changes proposed in this pull request:
Reviewers should focus on:
Screenshot
Necessity
Confirmed
composer test).Required changes:
None