Skip to content

A platform for community discussion. Free, open, simple.

UX: prevent anons from clearing pins in topic view

Régis Hanol826584b9c1dc
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;