From 826584b9c1dce7f59301c41c05a1a1d3eba95760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Wed, 31 Jan 2018 20:34:53 +0100 Subject: [PATCH] UX: prevent anons from clearing pins in topic view --- .../discourse/components/topic-status.js.es6 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/components/topic-status.js.es6 b/app/assets/javascripts/discourse/components/topic-status.js.es6 index f1c8695dfde..be8076458e9 100644 --- a/app/assets/javascripts/discourse/components/topic-status.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-status.js.es6 @@ -8,15 +8,10 @@ export default Ember.Component.extend(bufferedRender({ rerenderTriggers: ['topic.archived', 'topic.closed', 'topic.pinned', 'topic.visible', 'topic.unpinned', 'topic.is_warning'], click(e) { - if ($(e.target).hasClass('d-icon-thumb-tack')) { + // only pin unpin for now + if (this.get("canAct") && $(e.target).hasClass('d-icon-thumb-tack')) { const topic = this.get('topic'); - - // only pin unpin for now - if (topic.get('pinned')) { - topic.clearPin(); - } else { - topic.rePin(); - } + topic.get('pinned') ? topic.clearPin() : topic.rePin(); } return false;