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

Calling `transitionTo` directly was bypassing various custom codepaths of core.
This commit is contained in:
Joffrey JAFFEUX 2023-05-31 10:44:26 +02:00 committed by GitHub
parent 473992bd36
commit 80c18b97b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -21,6 +21,7 @@ import {
import isZoomed from "discourse/plugins/chat/discourse/lib/zoom-check"; import isZoomed from "discourse/plugins/chat/discourse/lib/zoom-check";
import { tracked } from "@glimmer/tracking"; import { tracked } from "@glimmer/tracking";
import discourseDebounce from "discourse-common/lib/debounce"; import discourseDebounce from "discourse-common/lib/debounce";
import DiscourseURL from "discourse/lib/url";
const PAGE_SIZE = 50; const PAGE_SIZE = 50;
const PAST = "past"; const PAST = "past";
@ -815,11 +816,14 @@ export default class ChatLivePane extends Component {
@action @action
onCloseFullScreen() { onCloseFullScreen() {
this.chatStateManager.prefersDrawer(); this.chatStateManager.prefersDrawer();
this.router.transitionTo(this.chatStateManager.lastKnownAppURL).then(() => {
DiscourseURL.routeTo(this.chatStateManager.lastKnownAppURL, {
afterRouteComplete: () => {
this.appEvents.trigger( this.appEvents.trigger(
"chat:open-url", "chat:open-url",
this.chatStateManager.lastKnownChatURL this.chatStateManager.lastKnownChatURL
); );
},
}); });
} }

View File

@ -5,6 +5,7 @@ import { cancel, throttle } from "@ember/runloop";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import { htmlSafe } from "@ember/template"; import { htmlSafe } from "@ember/template";
import { escapeExpression } from "discourse/lib/utilities"; import { escapeExpression } from "discourse/lib/utilities";
import DiscourseURL from "discourse/lib/url";
export default Component.extend({ export default Component.extend({
tagName: "", tagName: "",
@ -191,7 +192,7 @@ export default Component.extend({
this.chatStateManager.prefersFullPage(); this.chatStateManager.prefersFullPage();
this.chat.activeChannel = null; this.chat.activeChannel = null;
return this.router.transitionTo(this.chatStateManager.lastKnownChatURL); return DiscourseURL.routeTo(this.chatStateManager.lastKnownChatURL);
}, },
@action @action