mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 19:02:46 +08:00
FIX: Only show remove timer button to users with permission to do so
This commit is contained in:
parent
f1c67729de
commit
fca2f0f212
|
@ -1,6 +1,8 @@
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||||
import Category from "discourse/models/category";
|
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(
|
export default Ember.Component.extend(
|
||||||
bufferedRender({
|
bufferedRender({
|
||||||
|
@ -16,6 +18,12 @@ export default Ember.Component.extend(
|
||||||
"categoryId"
|
"categoryId"
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@computed("statusType")
|
||||||
|
canRemoveTimer(type) {
|
||||||
|
if (type === REMINDER_TYPE) return true;
|
||||||
|
return this.currentUser && this.currentUser.get("canManageTopic");
|
||||||
|
},
|
||||||
|
|
||||||
buildBuffer(buffer) {
|
buildBuffer(buffer) {
|
||||||
if (!this.executeAt) return;
|
if (!this.executeAt) return;
|
||||||
|
|
||||||
|
@ -65,7 +73,7 @@ export default Ember.Component.extend(
|
||||||
"far-clock"
|
"far-clock"
|
||||||
)} ${I18n.t(this._noticeKey(), options)}</span>`
|
)} ${I18n.t(this._noticeKey(), options)}</span>`
|
||||||
);
|
);
|
||||||
if (this.removeTopicTimer) {
|
if (this.removeTopicTimer && this.canRemoveTimer) {
|
||||||
buffer.push(
|
buffer.push(
|
||||||
`<button class="btn topic-timer-remove no-text" title="${I18n.t(
|
`<button class="btn topic-timer-remove no-text" title="${I18n.t(
|
||||||
"post.controls.remove_timer"
|
"post.controls.remove_timer"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user