DEV: /channel -> /c chat route rename (#19782)

* DEV: Rnemae channel path to just c

Also swap the channel id and channel slug params to be consistent with core.

* linting

* channel_path

* params in wrong order

* Drop slugify helper and channel route without slug

* Request slug and route models through the channel model if possible

* Add client side redirection for backwards-compatibility

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
Roman Rizzi
2023-01-27 09:58:12 -03:00
committed by GitHub
parent 079e1108f1
commit d07b472b79
54 changed files with 171 additions and 152 deletions
@@ -24,10 +24,7 @@
<DButton
@class="edit-name-btn btn-flat"
@label="chat.channel_settings.edit"
@action={{if
this.onEditChatChannelName
this.onEditChatChannelName
}}
@action={{if this.onEditChatChannelName this.onEditChatChannelName}}
/>
</div>
{{/if}}
@@ -90,4 +87,4 @@
leaveIcon="sign-out-alt"
}}
/>
</div>
</div>
@@ -11,7 +11,7 @@
<div class="chat-channel-card__header">
<LinkTo
@route="chat.channel"
@models={{array @channel.id (slugify-channel @channel)}}
@models={{@channel.routeModels}}
class="chat-channel-card__name-container"
>
<span class="chat-channel-card__name">
@@ -26,7 +26,7 @@
{{#if @channel.currentUserMembership.muted}}
<LinkTo
@route="chat.channel.info.settings"
@models={{array @channel.id (slugify-channel @channel)}}
@models={{@channel.routeModels}}
class="chat-channel-card__tag -muted"
tabindex="-1"
>
@@ -36,7 +36,7 @@
<LinkTo
@route="chat.channel.info.settings"
@models={{array @channel.id (slugify-channel @channel)}}
@models={{@channel.routeModels}}
class="chat-channel-card__setting"
tabindex="-1"
>
@@ -79,7 +79,7 @@
{{#if (gt @channel.membershipsCount 0)}}
<LinkTo
@route="chat.channel.info.members"
@models={{array @channel.id (slugify-channel @channel)}}
@models={{@channel.routeModels}}
class="chat-channel-card__members"
tabindex="-1"
>
@@ -1,6 +1,6 @@
<LinkTo
@route="chat.channel"
@models={{array @channel.id (or @channel.slug "-")}}
@models={{@channel.routeModels}}
class={{concat-class
"chat-channel-row"
(if @channel.focused "focused")
@@ -5,4 +5,4 @@
<ChatChannelArchiveStatus @channel={{this.channel}} />
</div>
{{/if}}
{{/if}}
@@ -47,10 +47,7 @@
{{#if this.chatStateManager.isDrawerExpanded}}
<LinkTo
@route={{this.infoTabRoute}}
@models={{array
this.chat.activeChannel.id
(slugify-channel this.chat.activeChannel)
}}
@models={{this.chat.activeChannel.routeModels}}
class="chat-drawer-header__title"
>
<div class="chat-drawer-header__top-line">
@@ -306,7 +306,7 @@ export default Component.extend({
return "/chat/draft-channel";
case CHAT_VIEW:
if (channel) {
return `/chat/channel/${channel.id}/${channel.slug || "-"}`;
return `/chat/c/${channel.slug || "-"}/${channel.id}`;
} else {
return "/chat";
}
@@ -16,7 +16,7 @@
<LinkTo
@route={{this.infoTabRoute}}
@models={{array this.chatChannel.id (slugify-channel this.chatChannel)}}
@models={{this.chatChannel.routeModels}}
class="chat-channel-title-wrapper"
>
<ChatChannelTitle @channel={{this.chatChannel}} />
@@ -152,4 +152,4 @@
{{else}}
<ChatChannelPreviewCard @channel={{this.chatChannel}} />
{{/if}}
{{/if}}
{{/if}}
@@ -786,7 +786,7 @@ export default Component.extend({
const { protocol, host } = window.location;
let url = getURL(
`/chat/channel/${this.details.chat_channel_id}/-?messageId=${this.message.id}`
`/chat/c/-/${this.details.chat_channel_id}?messageId=${this.message.id}`
);
url = url.indexOf("/") === 0 ? protocol + "//" + host + url : url;
clipboardCopy(url);
@@ -1,7 +1,7 @@
<div class="flagged-post-header">
<LinkTo
@route="chat.channel"
@models={{array this.chatChannel.id this.chatChannel.title}}
@models={{this.chatChannel.routeModels}}
@query={{hash messageId=@reviewable.target_id}}
>
<ChatChannelTitle @channel={{this.chatChannel}} />