Don't render 'Reply' button when user can't post

This commit is contained in:
verg 2014-02-14 14:10:22 -05:00
parent 067b220a62
commit 8447fd47e5
2 changed files with 3 additions and 3 deletions
app/assets/javascripts/discourse/views

View file

@ -8,9 +8,7 @@
**/ **/
Discourse.ReplyButton = Discourse.ButtonView.extend({ Discourse.ReplyButton = Discourse.ButtonView.extend({
classNames: ['btn', 'btn-primary', 'create'], classNames: ['btn', 'btn-primary', 'create'],
attributeBindings: ['disabled'],
helpKey: 'topic.reply.help', helpKey: 'topic.reply.help',
disabled: Em.computed.not('controller.model.details.can_create_post'),
text: function() { text: function() {
var archetypeCapitalized = this.get('controller.content.archetype').capitalize(); var archetypeCapitalized = this.get('controller.content.archetype').capitalize();

View file

@ -31,7 +31,9 @@ Discourse.TopicFooterButtonsView = Discourse.ContainerView.extend({
this.attachViewClass(Discourse.FlagTopicButton); this.attachViewClass(Discourse.FlagTopicButton);
} }
} }
this.attachViewClass(Discourse.ReplyButton); if (this.get('topic.details.can_create_post')) {
this.attachViewClass(Discourse.ReplyButton);
}
this.attachViewClass(Discourse.NotificationsButton); this.attachViewClass(Discourse.NotificationsButton);
this.trigger('additionalButtons', this); this.trigger('additionalButtons', this);