FIX: check post edit/delete permission
This commit is contained in:
parent
c62882aa76
commit
2412542c77
|
@ -159,6 +159,9 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
if (post.get('post_number') === 1) {
|
||||
this.deleteTopic();
|
||||
return;
|
||||
} else if (!post.can_delete) {
|
||||
// check if current user can delete post
|
||||
return false;
|
||||
}
|
||||
|
||||
const user = Discourse.User.current(),
|
||||
|
@ -200,6 +203,11 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||
return bootbox.alert(I18n.t('post.controls.edit_anonymous'));
|
||||
}
|
||||
|
||||
// check if current user can edit post
|
||||
if (!post.can_edit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const composer = this.get('controllers.composer'),
|
||||
composerModel = composer.get('model'),
|
||||
opts = {
|
||||
|
|
Loading…
Reference in New Issue