DEV: refactors routes to simplify using outlet (#20179)

This work will allow us to have an {{outlet}} chat.channel route and use it for threads as a sidepanel.
This commit is contained in:
Joffrey JAFFEUX
2023-02-07 13:59:32 +01:00
committed by GitHub
parent f4b56ea455
commit b89df3ca9d
20 changed files with 80 additions and 103 deletions
@@ -10,7 +10,7 @@
>
<div class="chat-channel-card__header">
<LinkTo
@route="chat.channel.from-params"
@route="chat.channel"
@models={{@channel.routeModels}}
class="chat-channel-card__name-container"
>
@@ -1,5 +1,5 @@
<LinkTo
@route="chat.channel.from-params"
@route="chat.channel"
@models={{@channel.routeModels}}
class={{concat-class
"chat-channel-row"
@@ -236,9 +236,9 @@ export default Component.extend({
this.set("view", DRAFT_CHANNEL_VIEW);
this.appEvents.trigger("chat:float-toggled", false);
return;
case "chat.channel.from-params":
case "chat.channel":
return this._openChannel(
route.parent.params.channelId,
route.params.channelId,
this._highlightCb(route.queryParams.messageId)
);
case "chat.channel.near-message":
@@ -15,7 +15,7 @@
{{/if}}
<LinkTo
@route={{this.infoTabRoute}}
@route="chat.channel.info"
@models={{this.chatChannel.routeModels}}
class="chat-channel-title-wrapper"
>
@@ -574,6 +574,8 @@ export default Component.extend({
return;
}
this.set("targetMessageId", messageId);
if (this.messageLookup[messageId]) {
// We have the message rendered. highlight and scrollTo
this.scrollToMessage(messageId, {
@@ -582,7 +584,6 @@ export default Component.extend({
autoExpand: true,
});
} else {
this.set("targetMessageId", messageId);
this.fetchMessages(this.chatChannel);
}
},
@@ -3,5 +3,6 @@
@chatChannel={{this.chat.activeChannel}}
@onBackClick={{action "navigateToIndex"}}
@onSwitchChannel={{action "switchChannel"}}
@targetMessageId={{readonly @targetMessageId}}
/>
{{/if}}