Skip to content

Commit a08af9a

Browse files
committed
Use User::can('post.delete')
1 parent 76d3431 commit a08af9a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

featherbb/Controller/Post.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function editpost($req, $res, $args)
259259
}
260260

261261
// Do we have permission to edit this post?
262-
if ((User::get()->g_edit_posts == '0' || $cur_post['poster_id'] != User::get()->id || $cur_post['closed'] == '1') && !$is_admmod) {
262+
if ((!User::can('post.edit') || $cur_post['poster_id'] != User::get()->id || $cur_post['closed'] == '1') && !$is_admmod) {
263263
throw new Error(__('No permission'), 403);
264264
}
265265

featherbb/Model/Topic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ public function print_posts($topic_id, $start_from, $cur_topic, $is_admmod)
957957
if ((($start_from + $post_count) == 1 && User::can('topic.delete')) || (($start_from + $post_count) > 1 && User::can('post.delete'))) {
958958
$cur_post['post_actions'][] = '<li class="postdelete"><span><a href="'.Router::pathFor('deletePost', ['id' => $cur_post['id']]).'">'.__('Delete').'</a></span></li>';
959959
}
960-
if (User::get()->g_edit_posts == '1') {
960+
if (User::can('post.edit')) {
961961
$cur_post['post_actions'][] = '<li class="postedit"><span><a href="'.Router::pathFor('editPost', ['id' => $cur_post['id']]).'">'.__('Edit').'</a></span></li>';
962962
}
963963
}

0 commit comments

Comments
 (0)