Skip to content

A platform for community discussion. Free, open, simple.

FIX: uses DiscourseURL.routeTo for drawer transitions (#21850)

Joffrey JAFFEUX80c18b97b491
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js b/plugins/chat/assets/javascripts/discourse/components/chat-channel.js
index 57eebba4f1c..c8cfe550f55 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel.js
@@ -21,6 +21,7 @@ import {
import isZoomed from "discourse/plugins/chat/discourse/lib/zoom-check";
import { tracked } from "@glimmer/tracking";
import discourseDebounce from "discourse-common/lib/debounce";
+import DiscourseURL from "discourse/lib/url";
const PAGE_SIZE = 50;
const PAST = "past";
@@ -815,11 +816,14 @@ export default class ChatLivePane extends Component {
@action
onCloseFullScreen() {
this.chatStateManager.prefersDrawer();
- this.router.transitionTo(this.chatStateManager.lastKnownAppURL).then(() => {
- this.appEvents.trigger(
- "chat:open-url",
- this.chatStateManager.lastKnownChatURL
- );
+
+ DiscourseURL.routeTo(this.chatStateManager.lastKnownAppURL, {
+ afterRouteComplete: () => {
+ this.appEvents.trigger(
+ "chat:open-url",
+ this.chatStateManager.lastKnownChatURL
+ );
+ },
});
}
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.js b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.js
index 50e5c353f2e..7732db38cff 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.js
@@ -5,6 +5,7 @@ import { cancel, throttle } from "@ember/runloop";
import { inject as service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import { escapeExpression } from "discourse/lib/utilities";
+import DiscourseURL from "discourse/lib/url";
export default Component.extend({
tagName: "",
@@ -191,7 +192,7 @@ export default Component.extend({
this.chatStateManager.prefersFullPage();
this.chat.activeChannel = null;
- return this.router.transitionTo(this.chatStateManager.lastKnownChatURL);
+ return DiscourseURL.routeTo(this.chatStateManager.lastKnownChatURL);
},
@action