UX: brings back URL on chat icon when in full page (#20092)

This commit is contained in:
Joffrey JAFFEUX 2023-01-31 10:16:45 +01:00 committed by GitHub
parent c3e978ada9
commit 697779b7e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 25 deletions

View File

@ -1,12 +1,3 @@
{{#if (and this.chatStateManager.isFullPageActive this.site.desktopView)}}
<span class={{concat-class "icon" (if this.isActive "active")}}>
{{d-icon "comment"}}
{{#unless this.currentUserInDnD}}
<ChatHeaderIconUnreadIndicator />
{{/unless}}
</span>
{{else}}
<a
href={{this.href}}
tabindex="0"
@ -18,4 +9,3 @@
<ChatHeaderIconUnreadIndicator />
{{/unless}}
</a>
{{/if}}

View File

@ -1,25 +1,31 @@
import { inject as service } from "@ember/service";
import Component from "@glimmer/component";
import getURL from "discourse-common/lib/get-url";
export default class ChatHeaderIcon extends Component {
@service currentUser;
@service site;
@service chatStateManager;
@service router;
get currentUserInDnD() {
return this.currentUser.isInDoNotDisturb();
}
get href() {
if (this.chatStateManager.isFullPageActive && this.site.mobileView) {
return "/chat";
if (this.chatStateManager.isFullPageActive) {
if (this.site.mobileView) {
return getURL("/chat");
} else {
return getURL(this.router.currentURL);
}
}
if (this.chatStateManager.isDrawerActive) {
return "/chat";
} else {
return this.chatStateManager.lastKnownChatURL || "/chat";
return getURL("/chat");
}
return getURL(this.chatStateManager.lastKnownChatURL || "/chat");
}
get isActive() {