FIX: Only show remove timer button to users with permission to do so

FIX: Only show remove timer button to users with permission to do so

diff --git a/app/assets/javascripts/discourse/components/topic-timer-info.js.es6 b/app/assets/javascripts/discourse/components/topic-timer-info.js.es6
index a96595a..288e61b 100644
--- a/app/assets/javascripts/discourse/components/topic-timer-info.js.es6
+++ b/app/assets/javascripts/discourse/components/topic-timer-info.js.es6
@@ -1,6 +1,8 @@
 import { iconHTML } from "discourse-common/lib/icon-library";
 import { bufferedRender } from "discourse-common/lib/buffered-render";
 import Category from "discourse/models/category";
+import computed from "ember-addons/ember-computed-decorators";
+import { REMINDER_TYPE } from "discourse/controllers/edit-topic-timer";
 
 export default Ember.Component.extend(
   bufferedRender({
@@ -16,6 +18,12 @@ export default Ember.Component.extend(
       "categoryId"
     ],
 
+    @computed("statusType")
+    canRemoveTimer(type) {
+      if (type === REMINDER_TYPE) return true;
+      return this.currentUser && this.currentUser.get("canManageTopic");
+    },
+
     buildBuffer(buffer) {
       if (!this.executeAt) return;
 
@@ -65,7 +73,7 @@ export default Ember.Component.extend(
             "far-clock"
           )} ${I18n.t(this._noticeKey(), options)}</span>`
         );
-        if (this.removeTopicTimer) {
+        if (this.removeTopicTimer && this.canRemoveTimer) {
           buffer.push(
             `<button class="btn topic-timer-remove no-text" title="${I18n.t(
               "post.controls.remove_timer"

GitHub sha: fca2f0f2

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: