diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index 8a6c7b22872..8d54f9918ac 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -374,10 +374,11 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, { togglePinnedForUser() { if (this.get('model.pinned_at')) { - if (this.get('pinned')) { - this.get('content').clearPin(); + const topic = this.get('content'); + if (topic.get('pinned')) { + topic.clearPin(); } else { - this.get('content').rePin(); + topic.rePin(); } } },