diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js b/plugins/chat/assets/javascripts/discourse/components/chat-channel.js index 13a6742a494..ccbefd36d57 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel.js @@ -132,6 +132,8 @@ export default class ChatLivePane extends Component { this.resetComposerMessage(); } + this.composer.focus(); + this.loadMessages(); } diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-composer.hbs index 2362a01ef15..a926032a91c 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-composer.hbs +++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer.hbs @@ -65,7 +65,6 @@ {{on "focusin" (fn this.computeIsFocused true)}} {{on "focusout" (fn this.computeIsFocused false)}} {{did-insert this.setupAutocomplete}} - {{did-insert this.composer.focus}} data-chat-composer-context={{this.context}} /> diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer.js b/plugins/chat/assets/javascripts/discourse/components/chat-composer.js index 65a07430b4f..e5a1740ca5b 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-composer.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer.js @@ -44,10 +44,6 @@ export default class ChatComposer extends Component { @tracked inProgressUploadsCount = 0; @tracked presenceChannelName; - get shouldRenderReplyingIndicator() { - return this.args.channel; - } - get shouldRenderMessageDetails() { return ( this.currentMessage?.editing || diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-thread.js b/plugins/chat/assets/javascripts/discourse/components/chat-thread.js index 7cbb7b731e1..7184f3664ba 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-thread.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-thread.js @@ -45,6 +45,7 @@ export default class ChatThreadPanel extends Component { @action didUpdateThread() { this.subscribeToUpdates(); + this.chatThreadComposer.focus(); this.loadMessages(); this.resetComposerMessage(); } diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/composer/channel.js b/plugins/chat/assets/javascripts/discourse/components/chat/composer/channel.js index 29eb42150e4..d8b406aef43 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat/composer/channel.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat/composer/channel.js @@ -14,6 +14,10 @@ export default class ChatComposerChannel extends ChatComposer { composerId = "channel-composer"; + get shouldRenderReplyingIndicator() { + return this.args.channel; + } + get presenceChannelName() { const channel = this.args.channel; return `/chat-reply/${channel.id}`; diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/composer/thread.js b/plugins/chat/assets/javascripts/discourse/components/chat/composer/thread.js index 7e95ab9e332..00f08e854fe 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat/composer/thread.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat/composer/thread.js @@ -18,6 +18,10 @@ export default class ChatComposerThread extends ChatComposer { this.composer.reset(this.args.thread); } + get shouldRenderReplyingIndicator() { + return this.args.thread; + } + get disabled() { return ( !this.chat.userCanInteractWithChat || diff --git a/plugins/chat/assets/javascripts/discourse/services/chat-channel-composer.js b/plugins/chat/assets/javascripts/discourse/services/chat-channel-composer.js index 64b5a67f001..1c0a8ff0a8f 100644 --- a/plugins/chat/assets/javascripts/discourse/services/chat-channel-composer.js +++ b/plugins/chat/assets/javascripts/discourse/services/chat-channel-composer.js @@ -15,7 +15,7 @@ export default class ChatChannelComposer extends Service { @action focus(options = {}) { - this.textarea.focus(options); + this.textarea?.focus(options); } @action