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:
Joffrey JAFFEUX
2025-04-09 21:45:25 +02:00
committed by Michael Brown
parent fb162ad64d
commit fff1ae60f1

View File

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