mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
DEV: ensures chat can work without discourse-presence
discourse presence can be disabled, given it's a plugin the `composerPresenceManager` service couldn't be present anymore and would cause an error. No test as it's testing imbrication of multiple plugins and hard to test reliably.
This commit is contained in:

committed by
Michael Brown

parent
fb162ad64d
commit
fff1ae60f1
@ -30,6 +30,7 @@ import userAutocomplete from "discourse/lib/autocomplete/user";
|
|||||||
import { setupHashtagAutocomplete } from "discourse/lib/hashtag-autocomplete";
|
import { setupHashtagAutocomplete } from "discourse/lib/hashtag-autocomplete";
|
||||||
import loadEmojiSearchAliases from "discourse/lib/load-emoji-search-aliases";
|
import loadEmojiSearchAliases from "discourse/lib/load-emoji-search-aliases";
|
||||||
import { cloneJSON } from "discourse/lib/object";
|
import { cloneJSON } from "discourse/lib/object";
|
||||||
|
import optionalService from "discourse/lib/optional-service";
|
||||||
import { emojiUrlFor } from "discourse/lib/text";
|
import { emojiUrlFor } from "discourse/lib/text";
|
||||||
import userSearch from "discourse/lib/user-search";
|
import userSearch from "discourse/lib/user-search";
|
||||||
import {
|
import {
|
||||||
@ -57,7 +58,6 @@ export default class ChatComposer extends Component {
|
|||||||
@service siteSettings;
|
@service siteSettings;
|
||||||
@service store;
|
@service store;
|
||||||
@service chat;
|
@service chat;
|
||||||
@service composerPresenceManager;
|
|
||||||
@service chatComposerWarningsTracker;
|
@service chatComposerWarningsTracker;
|
||||||
@service appEvents;
|
@service appEvents;
|
||||||
@service emojiStore;
|
@service emojiStore;
|
||||||
@ -67,6 +67,8 @@ export default class ChatComposer extends Component {
|
|||||||
@service modal;
|
@service modal;
|
||||||
@service menu;
|
@service menu;
|
||||||
|
|
||||||
|
@optionalService composerPresenceManager;
|
||||||
|
|
||||||
@tracked isFocused = false;
|
@tracked isFocused = false;
|
||||||
@tracked inProgressUploadsCount = 0;
|
@tracked inProgressUploadsCount = 0;
|
||||||
@tracked presenceChannelName;
|
@tracked presenceChannelName;
|
||||||
@ -312,7 +314,7 @@ export default class ChatComposer extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.composerPresenceManager.notifyState(
|
this.composerPresenceManager?.notifyState(
|
||||||
this.presenceChannelName,
|
this.presenceChannelName,
|
||||||
!this.draft.editing && this.hasContent,
|
!this.draft.editing && this.hasContent,
|
||||||
CHAT_PRESENCE_KEEP_ALIVE
|
CHAT_PRESENCE_KEEP_ALIVE
|
||||||
|
Reference in New Issue
Block a user