FIX: follow up to #7fca078 (#18915)

- prevents triggering chat:open-channel two times
- builds a correct URL for home page
This commit is contained in:
Joffrey JAFFEUX 2022-11-07 19:31:08 +01:00 committed by GitHub
parent e0edfa9345
commit 0a02a5d05a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import {
} from "discourse/lib/user-presence";
import isZoomed from "discourse/plugins/chat/discourse/lib/zoom-check";
import { isTesting } from "discourse-common/config/environment";
import { defaultHomepage } from "discourse/lib/utilities";
const MAX_RECENT_MSGS = 100;
const STICKY_SCROLL_LENIENCE = 50;
@ -1266,11 +1267,10 @@ export default Component.extend({
@action
onCloseFullScreen(channel) {
this.chatPreferredMode.setDrawer();
this.appEvents.trigger("chat:open-channel", channel);
let previousURL = this.fullPageChat.exit();
if (!previousURL || previousURL === "/") {
previousURL = "discovery";
previousURL = this.router.urlFor(`discovery.${defaultHomepage()}`);
}
this.router.replaceWith(previousURL).then(() => {

View File

@ -79,7 +79,7 @@ RSpec.describe "Navigation", type: :system, js: true do
chat_page.open_full_page
chat_page.minimize_full_page
expect(page).to have_current_path("/")
expect(page).to have_current_path(latest_path)
end
end