FIX: makes tracking shortcuts working when tracking button is not visible (#9575)
This commit is contained in:
parent
a8308e73e7
commit
07e6452759
|
@ -380,28 +380,30 @@ export default {
|
||||||
.send("showKeyboardShortcutsHelp");
|
.send("showKeyboardShortcutsHelp");
|
||||||
},
|
},
|
||||||
|
|
||||||
setTrackingToMuted(event) {
|
setTrackingToMuted() {
|
||||||
throttle(this, "_setTracking", { id: 0, event }, INPUT_DELAY, true);
|
throttle(this, "_setTracking", 0, INPUT_DELAY, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTrackingToRegular(event) {
|
setTrackingToRegular() {
|
||||||
throttle(this, "_setTracking", { id: 1, event }, INPUT_DELAY, true);
|
throttle(this, "_setTracking", 1, INPUT_DELAY, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTrackingToTracking(event) {
|
setTrackingToTracking() {
|
||||||
throttle(this, "_setTracking", { id: 2, event }, INPUT_DELAY, true);
|
throttle(this, "_setTracking", 2, INPUT_DELAY, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
setTrackingToWatching(event) {
|
setTrackingToWatching() {
|
||||||
throttle(this, "_setTracking", { id: 3, event }, INPUT_DELAY, true);
|
throttle(this, "_setTracking", 3, INPUT_DELAY, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setTracking(params) {
|
_setTracking(levelId) {
|
||||||
this.appEvents.trigger("topic-notifications-button:changed", {
|
const topic = this.currentTopic();
|
||||||
type: "notification",
|
|
||||||
id: params.id,
|
if (!topic) {
|
||||||
event: params.event
|
return;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
topic.details.updateNotifications(levelId);
|
||||||
},
|
},
|
||||||
|
|
||||||
sendToTopicListItemView(action, elem) {
|
sendToTopicListItemView(action, elem) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { action } from "@ember/object";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
layoutName: "select-kit/templates/components/topic-notifications-button",
|
layoutName: "select-kit/templates/components/topic-notifications-button",
|
||||||
|
@ -6,51 +7,13 @@ export default Component.extend({
|
||||||
appendReason: true,
|
appendReason: true,
|
||||||
showFullTitle: true,
|
showFullTitle: true,
|
||||||
placement: "bottom-start",
|
placement: "bottom-start",
|
||||||
|
notificationLevel: null,
|
||||||
|
topic: null,
|
||||||
|
|
||||||
didInsertElement() {
|
@action
|
||||||
this._super(...arguments);
|
changeTopicNotificationLevel(levelId) {
|
||||||
|
if (levelId !== this.notificationLevel) {
|
||||||
if (!this.mountedAsWidget) {
|
this.topic.details.updateNotifications(levelId);
|
||||||
this.appEvents.on(
|
|
||||||
"topic-notifications-button:changed",
|
|
||||||
this,
|
|
||||||
"_changeTopicNotificationLevel"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
willDestroyElement() {
|
|
||||||
this._super(...arguments);
|
|
||||||
|
|
||||||
if (!this.mountedAsWidget) {
|
|
||||||
this.appEvents.off(
|
|
||||||
"topic-notifications-button:changed",
|
|
||||||
this,
|
|
||||||
"_changeTopicNotificationLevel"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_changeTopicNotificationLevel(level) {
|
|
||||||
// this change is coming from a keyboard event
|
|
||||||
if (level.event) {
|
|
||||||
const topicSectionNode = level.event.target.querySelector("#topic");
|
|
||||||
if (topicSectionNode && topicSectionNode.dataset.topicId) {
|
|
||||||
const topicId = parseInt(topicSectionNode.dataset.topicId, 10);
|
|
||||||
if (topicId && topicId !== this.topic.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (level.id !== this.notificationLevel) {
|
|
||||||
this.topic.details.updateNotifications(level.id);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
changeTopicNotificationLevel(level, notification) {
|
|
||||||
this._changeTopicNotificationLevel(notification);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue