FIX: check post edit/delete permission

This commit is contained in:
Arpit Jalan 2015-12-16 19:02:16 +05:30
parent c62882aa76
commit 2412542c77
1 changed files with 8 additions and 0 deletions

View File

@ -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 = {