mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 06:49:30 +08:00
DEV: Make capabilities
into a service (#18678)
This commit is contained in:
@ -18,7 +18,6 @@ import {
|
||||
} from "discourse/lib/user-presence";
|
||||
import isZoomed from "discourse/plugins/chat/discourse/lib/zoom-check";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
|
||||
const PAGE_SIZE = 50;
|
||||
const PAST = "past";
|
||||
@ -26,6 +25,7 @@ const FUTURE = "future";
|
||||
const READ_INTERVAL_MS = 1000;
|
||||
|
||||
export default class ChatLivePane extends Component {
|
||||
@service capabilities;
|
||||
@service chat;
|
||||
@service chatChannelsManager;
|
||||
@service router;
|
||||
@ -136,10 +136,6 @@ export default class ChatLivePane extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
get capabilities() {
|
||||
return getOwner(this).lookup("capabilities:main");
|
||||
}
|
||||
|
||||
@debounce(100)
|
||||
fetchMessages(options = {}) {
|
||||
if (this._selfDeleted) {
|
||||
|
@ -1,20 +1,18 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import discourseLater from "discourse-common/lib/later";
|
||||
import { action } from "@ember/object";
|
||||
import { isTesting } from "discourse-common/config/environment";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default class ChatMessageActionsMobile extends Component {
|
||||
@service capabilities;
|
||||
|
||||
@tracked hasExpandedReply = false;
|
||||
@tracked showFadeIn = false;
|
||||
|
||||
messageActions = null;
|
||||
|
||||
get capabilities() {
|
||||
return getOwner(this).lookup("capabilities:main");
|
||||
}
|
||||
|
||||
@action
|
||||
fadeAndVibrate() {
|
||||
discourseLater(this.#addFadeIn.bind(this));
|
||||
|
@ -16,7 +16,6 @@ import isZoomed from "discourse/plugins/chat/discourse/lib/zoom-check";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import ChatMessageFlag from "discourse/plugins/chat/discourse/lib/chat-message-flag";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
import ChatMessageReaction from "discourse/plugins/chat/discourse/models/chat-message-reaction";
|
||||
|
||||
let _chatMessageDecorators = [];
|
||||
@ -38,6 +37,7 @@ export default class ChatMessage extends Component {
|
||||
@service dialog;
|
||||
@service currentUser;
|
||||
@service appEvents;
|
||||
@service capabilities;
|
||||
@service chat;
|
||||
@service chatEmojiReactionStore;
|
||||
@service chatEmojiPickerManager;
|
||||
@ -482,10 +482,6 @@ export default class ChatMessage extends Component {
|
||||
this.react(emoji, REACTIONS.add);
|
||||
}
|
||||
|
||||
get capabilities() {
|
||||
return getOwner(this).lookup("capabilities:main");
|
||||
}
|
||||
|
||||
@action
|
||||
react(emoji, reactAction) {
|
||||
if (!this.args.canInteractWithChat) {
|
||||
|
Reference in New Issue
Block a user