This commit automatically ensures that category channels have slugs when they are created or updated based on the channel name, category name, or existing slug. The behaviour has been copied from the Category model. We also include a backfill here with a simplified version of Slug.for with deduplication to fill the slugs for already created Category chat channels. The channel slug is also now used for chat notifications, and for the UI and navigation for chat. `slugifyChannel` is still used, but now does the following fallback: * Uses channel.slug if it is present * Uses channel.escapedTitle if it is present * Uses channel.title if it is present In future we may want to remove this altogether and always rely on the slug being present, but this is currently not possible because we are not generating slugs for DM channels at this point.
93 lines
3.8 KiB
Handlebars
93 lines
3.8 KiB
Handlebars
<div class="chat-drawer">
|
|
<div
|
|
class={{this.containerClassNames}}
|
|
data-chat-channel-id={{this.chat.activeChannel.id}}
|
|
>
|
|
<div
|
|
role="region"
|
|
aria-label={{i18n "chat.aria_roles.header"}}
|
|
class="topic-chat-drawer-header"
|
|
>
|
|
{{#if (and this.draftChannelView this.expanded)}}
|
|
<div class="topic-chat-drawer-header__left-actions">
|
|
<div class="topic-chat-drawer-header__top-line">
|
|
<FlatButton @class="topic-chat-drawer-header__return-to-channels-btn" @icon="chevron-left" @action={{action "fetchChannels"}} @title="chat.return_to_list" />
|
|
</div>
|
|
</div>
|
|
|
|
<span class="topic-chat-drawer-header__title">
|
|
<div class="topic-chat-drawer-header__top-line">
|
|
{{i18n "chat.direct_message_creator.title"}}
|
|
</div>
|
|
</span>
|
|
{{else if this.chatView}}
|
|
{{#if this.expanded}}
|
|
<div class="topic-chat-drawer-header__left-actions">
|
|
<FlatButton @class="topic-chat-drawer-header__return-to-channels-btn" @icon="chevron-left" @action={{action "fetchChannels"}} @title="chat.return_to_list" />
|
|
</div>
|
|
{{/if}}
|
|
|
|
{{#if this.chat.activeChannel}}
|
|
{{#if this.expanded}}
|
|
<LinkTo @route={{this.infoTabRoute}} @models={{array this.chat.activeChannel.id (slugify-channel this.chat.activeChannel)}} class="topic-chat-drawer-header__title">
|
|
<div class="topic-chat-drawer-header__top-line">
|
|
<ChatChannelTitle @channel={{this.chat.activeChannel}} />
|
|
</div>
|
|
</LinkTo>
|
|
{{else}}
|
|
<div role="button" {{on "click" (action "toggleExpand")}} class="topic-chat-drawer-header__title">
|
|
<div class="topic-chat-drawer-header__top-line">
|
|
<ChatChannelTitle @channel={{this.chat.activeChannel}}>
|
|
{{#if this.unreadCount}}
|
|
<span class="chat-unread-count">{{this.unreadCount}}</span>
|
|
{{/if}}
|
|
</ChatChannelTitle>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
{{/if}}
|
|
{{else}}
|
|
<span class="topic-chat-drawer-header__title">
|
|
<div class="topic-chat-drawer-header__top-line">
|
|
{{i18n "chat.heading"}}
|
|
</div>
|
|
</span>
|
|
{{/if}}
|
|
|
|
<div class="topic-chat-drawer-header__right-actions">
|
|
<div class="topic-chat-drawer-header__top-line {{this.topLineClass}}">
|
|
{{#if this.expanded}}
|
|
<button
|
|
class="btn-flat topic-chat-drawer-header__full-screen-btn"
|
|
onmouseup={{action "openInFullPage"}}
|
|
icon="discourse-expand"
|
|
title={{i18n "chat.open_full_page"}}
|
|
type="button"
|
|
>
|
|
{{d-icon "discourse-expand"}}
|
|
</button>
|
|
{{/if}}
|
|
|
|
<FlatButton @icon={{this.expandIcon}} @class="topic-chat-drawer-header__expand-btn" @action={{action "toggleExpand"}} @title="chat.collapse" />
|
|
|
|
{{#if this.showClose}}
|
|
<FlatButton @icon="times" @action={{action "close"}} @title="chat.close" @class="topic-chat-drawer-header__close-btn" />
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{#if this.expanded}}
|
|
<div class="topic-chat-drawer-content">
|
|
{{#if (and this.chatView this.chat.activeChannel)}}
|
|
<ChatLivePane @chatChannel={{this.chat.activeChannel}} @expanded={{this.expanded}} @floatHidden={{this.hidden}} @fullPage={{false}} @onSwitchChannel={{action "switchChannel"}} />
|
|
{{else if this.draftChannelView}}
|
|
<ChatDraftChannelScreen @onSwitchChannel={{action "switchChannel"}} />
|
|
{{else}}
|
|
<ChannelsList @floatHidden={{this.hidden}} @onOpenView={{action "openView"}} @onSelect={{action "switchChannel"}} />
|
|
{{/if}}
|
|
</div>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|