mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
DEV: prep for gjs conversion: rename .js -> .gjs
Some of these files are quite small, and if we rename them in the same commit where we inlined the template, Git may choose to see them as different files. This commit forces Git to recognize the rename, which will preserve the lineage of the refactored files.
This commit is contained in:

committed by
David Taylor

parent
016e91380c
commit
e1f74fcb4b
@ -0,0 +1,86 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { bind } from "discourse-common/utils/decorators";
|
||||
|
||||
export default class ChatMessageThreadIndicator extends Component {
|
||||
@service capabilities;
|
||||
@service chat;
|
||||
@service chatStateManager;
|
||||
@service router;
|
||||
@service site;
|
||||
|
||||
@tracked isActive = false;
|
||||
|
||||
@action
|
||||
setup(element) {
|
||||
this.element = element;
|
||||
|
||||
if (this.capabilities.touch) {
|
||||
this.element.addEventListener("touchstart", this.onTouchStart, {
|
||||
passive: true,
|
||||
});
|
||||
this.element.addEventListener("touchmove", this.cancelTouch, {
|
||||
passive: true,
|
||||
});
|
||||
this.element.addEventListener("touchend", this.onTouchEnd);
|
||||
this.element.addEventListener("touchCancel", this.cancelTouch);
|
||||
}
|
||||
|
||||
this.element.addEventListener("click", this.openThread, {
|
||||
passive: true,
|
||||
});
|
||||
}
|
||||
|
||||
@action
|
||||
teardown() {
|
||||
if (this.capabilities.touch) {
|
||||
this.element.removeEventListener("touchstart", this.onTouchStart, {
|
||||
passive: true,
|
||||
});
|
||||
this.element.removeEventListener("touchmove", this.cancelTouch, {
|
||||
passive: true,
|
||||
});
|
||||
this.element.removeEventListener("touchend", this.onTouchEnd);
|
||||
this.element.removeEventListener("touchCancel", this.cancelTouch);
|
||||
}
|
||||
|
||||
this.element.removeEventListener("click", this.openThread, {
|
||||
passive: true,
|
||||
});
|
||||
}
|
||||
|
||||
@bind
|
||||
onTouchStart(event) {
|
||||
this.isActive = true;
|
||||
event.stopPropagation();
|
||||
|
||||
this.touching = true;
|
||||
}
|
||||
|
||||
@bind
|
||||
onTouchEnd() {
|
||||
this.isActive = false;
|
||||
|
||||
if (this.touching) {
|
||||
this.openThread();
|
||||
}
|
||||
}
|
||||
|
||||
@bind
|
||||
cancelTouch() {
|
||||
this.isActive = false;
|
||||
this.touching = false;
|
||||
}
|
||||
|
||||
@bind
|
||||
openThread() {
|
||||
this.chat.activeMessage = null;
|
||||
|
||||
this.router.transitionTo(
|
||||
"chat.channel.thread",
|
||||
...this.args.message.thread.routeModels
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user