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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 171 additions and 152 deletions

0
.byebug_history Normal file
View File

View File

@ -76,11 +76,11 @@ class ChatChannel < ActiveRecord::Base
end end
def url def url
"#{Discourse.base_url}/chat/channel/#{self.id}/#{self.slug || "-"}" "#{Discourse.base_url}/chat/c/#{self.slug || "-"}/#{self.id}"
end end
def relative_url def relative_url
"#{Discourse.base_path}/chat/channel/#{self.id}/#{self.slug || "-"}" "#{Discourse.base_path}/chat/c/#{self.slug || "-"}/#{self.id}"
end end
def self.ensure_consistency! def self.ensure_consistency!

View File

@ -1,8 +1,13 @@
export default function () { export default function () {
this.route("chat", { path: "/chat" }, function () { this.route("chat", { path: "/chat" }, function () {
// TODO(roman): Remove after the 3.1 release
this.route("channel-legacy", {
path: "/channel/:channelId/:channelTitle",
});
this.route( this.route(
"channel", "channel",
{ path: "/channel/:channelId/:channelTitle" }, { path: "/c/:channelTitle/:channelId/" },
function () { function () {
this.route("info", { path: "/info" }, function () { this.route("info", { path: "/info" }, function () {
this.route("about", { path: "/about" }); this.route("about", { path: "/about" });

View File

@ -24,10 +24,7 @@
<DButton <DButton
@class="edit-name-btn btn-flat" @class="edit-name-btn btn-flat"
@label="chat.channel_settings.edit" @label="chat.channel_settings.edit"
@action={{if @action={{if this.onEditChatChannelName this.onEditChatChannelName}}
this.onEditChatChannelName
this.onEditChatChannelName
}}
/> />
</div> </div>
{{/if}} {{/if}}

View File

@ -11,7 +11,7 @@
<div class="chat-channel-card__header"> <div class="chat-channel-card__header">
<LinkTo <LinkTo
@route="chat.channel" @route="chat.channel"
@models={{array @channel.id (slugify-channel @channel)}} @models={{@channel.routeModels}}
class="chat-channel-card__name-container" class="chat-channel-card__name-container"
> >
<span class="chat-channel-card__name"> <span class="chat-channel-card__name">
@ -26,7 +26,7 @@
{{#if @channel.currentUserMembership.muted}} {{#if @channel.currentUserMembership.muted}}
<LinkTo <LinkTo
@route="chat.channel.info.settings" @route="chat.channel.info.settings"
@models={{array @channel.id (slugify-channel @channel)}} @models={{@channel.routeModels}}
class="chat-channel-card__tag -muted" class="chat-channel-card__tag -muted"
tabindex="-1" tabindex="-1"
> >
@ -36,7 +36,7 @@
<LinkTo <LinkTo
@route="chat.channel.info.settings" @route="chat.channel.info.settings"
@models={{array @channel.id (slugify-channel @channel)}} @models={{@channel.routeModels}}
class="chat-channel-card__setting" class="chat-channel-card__setting"
tabindex="-1" tabindex="-1"
> >
@ -79,7 +79,7 @@
{{#if (gt @channel.membershipsCount 0)}} {{#if (gt @channel.membershipsCount 0)}}
<LinkTo <LinkTo
@route="chat.channel.info.members" @route="chat.channel.info.members"
@models={{array @channel.id (slugify-channel @channel)}} @models={{@channel.routeModels}}
class="chat-channel-card__members" class="chat-channel-card__members"
tabindex="-1" tabindex="-1"
> >

View File

@ -1,6 +1,6 @@
<LinkTo <LinkTo
@route="chat.channel" @route="chat.channel"
@models={{array @channel.id (or @channel.slug "-")}} @models={{@channel.routeModels}}
class={{concat-class class={{concat-class
"chat-channel-row" "chat-channel-row"
(if @channel.focused "focused") (if @channel.focused "focused")

View File

@ -47,10 +47,7 @@
{{#if this.chatStateManager.isDrawerExpanded}} {{#if this.chatStateManager.isDrawerExpanded}}
<LinkTo <LinkTo
@route={{this.infoTabRoute}} @route={{this.infoTabRoute}}
@models={{array @models={{this.chat.activeChannel.routeModels}}
this.chat.activeChannel.id
(slugify-channel this.chat.activeChannel)
}}
class="chat-drawer-header__title" class="chat-drawer-header__title"
> >
<div class="chat-drawer-header__top-line"> <div class="chat-drawer-header__top-line">

View File

@ -306,7 +306,7 @@ export default Component.extend({
return "/chat/draft-channel"; return "/chat/draft-channel";
case CHAT_VIEW: case CHAT_VIEW:
if (channel) { if (channel) {
return `/chat/channel/${channel.id}/${channel.slug || "-"}`; return `/chat/c/${channel.slug || "-"}/${channel.id}`;
} else { } else {
return "/chat"; return "/chat";
} }

View File

@ -16,7 +16,7 @@
<LinkTo <LinkTo
@route={{this.infoTabRoute}} @route={{this.infoTabRoute}}
@models={{array this.chatChannel.id (slugify-channel this.chatChannel)}} @models={{this.chatChannel.routeModels}}
class="chat-channel-title-wrapper" class="chat-channel-title-wrapper"
> >
<ChatChannelTitle @channel={{this.chatChannel}} /> <ChatChannelTitle @channel={{this.chatChannel}} />

View File

@ -786,7 +786,7 @@ export default Component.extend({
const { protocol, host } = window.location; const { protocol, host } = window.location;
let url = getURL( 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; url = url.indexOf("/") === 0 ? protocol + "//" + host + url : url;
clipboardCopy(url); clipboardCopy(url);

View File

@ -1,7 +1,7 @@
<div class="flagged-post-header"> <div class="flagged-post-header">
<LinkTo <LinkTo
@route="chat.channel" @route="chat.channel"
@models={{array this.chatChannel.id this.chatChannel.title}} @models={{this.chatChannel.routeModels}}
@query={{hash messageId=@reviewable.target_id}} @query={{hash messageId=@reviewable.target_id}}
> >
<ChatChannelTitle @channel={{this.chatChannel}} /> <ChatChannelTitle @channel={{this.chatChannel}} />

View File

@ -15,7 +15,7 @@ registerUnbound("format-chat-date", function (message, details, mode) {
if (details) { if (details) {
url = getURL( url = getURL(
`/chat/channel/${details.chat_channel_id}/-?messageId=${message.id}` `/chat/c/-/${details.chat_channel_id}?messageId=${message.id}`
); );
} }

View File

@ -1,8 +0,0 @@
import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";
import Helper from "@ember/component/helper";
export default class SlugifyChannel extends Helper {
compute(inputs) {
return slugifyChannel(inputs[0]);
}
}

View File

@ -1,5 +1,4 @@
import { htmlSafe } from "@ember/template"; import { htmlSafe } from "@ember/template";
import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";
import { withPluginApi } from "discourse/lib/plugin-api"; import { withPluginApi } from "discourse/lib/plugin-api";
import I18n from "I18n"; import I18n from "I18n";
import { bind } from "discourse-common/utils/decorators"; import { bind } from "discourse-common/utils/decorators";
@ -32,7 +31,7 @@ export default {
} }
get name() { get name() {
return dasherize(slugifyChannel(this.channel)); return dasherize(this.channel.slugifiedTitle);
} }
@computed("chatService.activeChannel") @computed("chatService.activeChannel")
@ -57,7 +56,7 @@ export default {
} }
get models() { get models() {
return [this.channel.id, slugifyChannel(this.channel)]; return this.channel.routeModels;
} }
get text() { get text() {
@ -195,7 +194,7 @@ export default {
} }
get name() { get name() {
return slugifyChannel(this.channel); return this.channel.slugifiedTitle;
} }
@computed("chatService.activeChannel") @computed("chatService.activeChannel")
@ -220,7 +219,7 @@ export default {
} }
get models() { get models() {
return [this.channel.id, slugifyChannel(this.channel)]; return this.channel.routeModels;
} }
get title() { get title() {

View File

@ -24,11 +24,9 @@ export default {
title: this.notification.data.chat_channel_title, title: this.notification.data.chat_channel_title,
slug: this.notification.data.chat_channel_slug, slug: this.notification.data.chat_channel_slug,
}); });
return `/chat/channel/${ return `/chat/c/${slug || "-"}/${
this.notification.data.chat_channel_id this.notification.data.chat_channel_id
}/${slug || "-"}?messageId=${ }?messageId=${this.notification.data.chat_message_id}`;
this.notification.data.chat_message_id
}`;
} }
get linkTitle() { get linkTitle() {
@ -61,11 +59,9 @@ export default {
title: this.notification.data.chat_channel_title, title: this.notification.data.chat_channel_title,
slug: this.notification.data.chat_channel_slug, slug: this.notification.data.chat_channel_slug,
}); });
return `/chat/channel/${ return `/chat/c/${slug || "-"}/${
this.notification.data.chat_channel_id this.notification.data.chat_channel_id
}/${slug || "-"}?messageId=${ }?messageId=${this.notification.data.chat_message_id}`;
this.notification.data.chat_message_id
}`;
} }
get linkTitle() { get linkTitle() {

View File

@ -4,6 +4,11 @@ export default function slugifyChannel(channel) {
if (channel.slug) { if (channel.slug) {
return channel.slug; return channel.slug;
} }
if (!channel.escapedTitle && !channel.title) {
return "-";
}
const slug = slugify(channel.escapedTitle || channel.title); const slug = slugify(channel.escapedTitle || channel.title);
const resolvedSlug = ( const resolvedSlug = (
slug.length slug.length

View File

@ -5,6 +5,7 @@ import UserChatChannelMembership from "discourse/plugins/chat/discourse/models/u
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { escapeExpression } from "discourse/lib/utilities"; import { escapeExpression } from "discourse/lib/utilities";
import { tracked } from "@glimmer/tracking"; import { tracked } from "@glimmer/tracking";
import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";
export const CHATABLE_TYPES = { export const CHATABLE_TYPES = {
directMessageChannel: "DirectMessage", directMessageChannel: "DirectMessage",
@ -73,6 +74,14 @@ export default class ChatChannel extends RestModel {
return escapeExpression(this.description); return escapeExpression(this.description);
} }
get slugifiedTitle() {
return this.slug || slugifyChannel(this);
}
get routeModels() {
return [this.slugifiedTitle, this.id];
}
get isDirectMessageChannel() { get isDirectMessageChannel() {
return this.chatable_type === CHATABLE_TYPES.directMessageChannel; return this.chatable_type === CHATABLE_TYPES.directMessageChannel;
} }

View File

@ -0,0 +1,16 @@
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
export default class ChatChannelLegacyRoute extends DiscourseRoute {
@service router;
redirect() {
const { channelTitle, channelId, messageId } = this.paramsFor(
this.routeName
);
this.router.replaceWith("chat.channel", channelTitle, channelId, {
queryParams: { messageId },
});
}
}

View File

@ -1,6 +1,5 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";
import { action } from "@ember/object"; import { action } from "@ember/object";
import { schedule } from "@ember/runloop"; import { schedule } from "@ember/runloop";
@ -17,9 +16,8 @@ export default class ChatChannelRoute extends DiscourseRoute {
this.chat.setActiveChannel(model); this.chat.setActiveChannel(model);
const { channelTitle, messageId } = this.paramsFor(this.routeName); const { channelTitle, messageId } = this.paramsFor(this.routeName);
const slug = slugifyChannel(model); if (channelTitle !== model.slugifiedTitle) {
if (channelTitle !== slug) { this.router.replaceWith("chat.channel.index", ...model.routeModels, {
this.router.replaceWith("chat.channel.index", model.id, slug, {
queryParams: { messageId }, queryParams: { messageId },
}); });
} }

View File

@ -11,8 +11,8 @@ export default class ChatMessageRoute extends DiscourseRoute {
.then((response) => { .then((response) => {
this.transitionTo( this.transitionTo(
"chat.channel", "chat.channel",
response.chat_channel_id,
response.chat_channel_title, response.chat_channel_title,
response.chat_channel_id,
{ {
queryParams: { messageId: params.messageId }, queryParams: { messageId: params.messageId },
} }

View File

@ -57,7 +57,7 @@ export default class ChatNotificationManager extends Service {
@bind @bind
_pageChanged(path) { _pageChanged(path) {
this.set("_inChat", path.startsWith("/chat/channel/")); this.set("_inChat", path.startsWith("/chat/c/"));
if (this._inChat) { if (this._inChat) {
this._chatPresenceChannel.enter({ onlyWhileActive: false }); this._chatPresenceChannel.enter({ onlyWhileActive: false });
this._corePresenceChannel.leave(); this._corePresenceChannel.leave();

View File

@ -1,4 +1,3 @@
import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";
import deprecated from "discourse-common/lib/deprecated"; import deprecated from "discourse-common/lib/deprecated";
import userSearch from "discourse/lib/user-search"; import userSearch from "discourse/lib/user-search";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
@ -297,8 +296,8 @@ export default class Chat extends Service {
return this.router.transitionTo( return this.router.transitionTo(
"chat.channel", "chat.channel",
channel.slugifiedTitle,
channel.id, channel.id,
slugifyChannel(channel),
{ queryParams } { queryParams }
); );
} else { } else {

View File

@ -13,7 +13,7 @@
{{else}} {{else}}
<LinkTo <LinkTo
@route="chat.channel" @route="chat.channel"
@models={{array this.model.id (slugify-channel this.model)}} @models={{this.model.routeModels}}
class="chat-full-page-header__back-btn no-text btn-flat btn" class="chat-full-page-header__back-btn no-text btn-flat btn"
title={{i18n "chat.channel_info.back_to_channel"}} title={{i18n "chat.channel_info.back_to_channel"}}
> >
@ -38,7 +38,7 @@
> >
<LinkTo <LinkTo
@route={{concat "chat.channel.info." tab}} @route={{concat "chat.channel.info." tab}}
@models={{array this.model.id (slugify-channel this.model)}} @models={{this.model.routeModels}}
class="chat-tabs-list__link" class="chat-tabs-list__link"
> >
<span>{{i18n (concat "chat.channel_info.tabs." tab)}}</span> <span>{{i18n (concat "chat.channel_info.tabs." tab)}}</span>

View File

@ -38,7 +38,7 @@ createWidgetFrom(DefaultNotificationItem, "chat-invitation-notification-item", {
title: data.chat_channel_title, title: data.chat_channel_title,
slug: data.chat_channel_slug, slug: data.chat_channel_slug,
}); });
return `/chat/channel/${data.chat_channel_id}/${slug || "-"}?messageId=${ return `/chat/c/${slug || "-"}/${data.chat_channel_id}?messageId=${
data.chat_message_id data.chat_message_id
}`; }`;
}, },

View File

@ -48,7 +48,7 @@ const chatNotificationItem = {
title: data.chat_channel_title, title: data.chat_channel_title,
slug: data.chat_channel_slug, slug: data.chat_channel_slug,
}); });
return `/chat/channel/${data.chat_channel_id}/${slug || "-"}?messageId=${ return `/chat/c/${slug || "-"}/${data.chat_channel_id}?messageId=${
data.chat_message_id data.chat_message_id
}`; }`;
}, },

View File

@ -21,7 +21,7 @@ const chatTranscriptRule = {
const channelName = tagInfo.attrs.channel; const channelName = tagInfo.attrs.channel;
const channelId = tagInfo.attrs.channelId; const channelId = tagInfo.attrs.channelId;
const channelLink = channelId const channelLink = channelId
? options.getURL(`/chat/channel/${channelId}/-`) ? options.getURL(`/chat/c/-/${channelId}`)
: null; : null;
if (!username || !messageIdStart || !messageTimeStart) { if (!username || !messageIdStart || !messageTimeStart) {

View File

@ -39,7 +39,7 @@
<div class="chat-transcript-datetime"> <div class="chat-transcript-datetime">
<a href="{{url}}" title="{{created_at}}">{{created_at}}</a> <a href="{{url}}" title="{{created_at}}">{{created_at}}</a>
</div> </div>
<a class="chat-transcript-channel" href="/chat/channel/{{channel_id}}/-"> <a class="chat-transcript-channel" href="/chat/c/-/{{channel_id}}">
{{#is_category}} {{#is_category}}
<span class="category-chat-badge" style="color: #{{color}}"> <span class="category-chat-badge" style="color: #{{color}}">
<svg class="fa d-icon d-icon-hashtag svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#hashtag"></use></svg> <svg class="fa d-icon d-icon-hashtag svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#hashtag"></use></svg>

View File

@ -631,12 +631,6 @@ after_initialize do
get "/browse/open" => "chat#respond" get "/browse/open" => "chat#respond"
get "/browse/archived" => "chat#respond" get "/browse/archived" => "chat#respond"
get "/draft-channel" => "chat#respond" get "/draft-channel" => "chat#respond"
get "/channel/:channel_id" => "chat#respond"
get "/channel/:channel_id/:channel_title" => "chat#respond", :as => "channel"
get "/channel/:channel_id/:channel_title/info" => "chat#respond"
get "/channel/:channel_id/:channel_title/info/about" => "chat#respond"
get "/channel/:channel_id/:channel_title/info/members" => "chat#respond"
get "/channel/:channel_id/:channel_title/info/settings" => "chat#respond"
post "/enable" => "chat#enable_chat" post "/enable" => "chat#enable_chat"
post "/disable" => "chat#disable_chat" post "/disable" => "chat#disable_chat"
post "/dismiss-retention-reminder" => "chat#dismiss_retention_reminder" post "/dismiss-retention-reminder" => "chat#dismiss_retention_reminder"
@ -657,6 +651,25 @@ after_initialize do
post "/:chat_channel_id" => "chat#create_message" post "/:chat_channel_id" => "chat#create_message"
put "/flag" => "chat#flag" put "/flag" => "chat#flag"
get "/emojis" => "emojis#index" get "/emojis" => "emojis#index"
base_c_route = "/c/:channel_title/:channel_id"
get base_c_route => "chat#respond", :as => "channel"
%w[info info/about info/members info/settings].each do |route|
get "#{base_c_route}/#{route}" => "chat#respond"
end
# /channel -> /c redirects
get "/channel/:channel_id", to: redirect("/chat/c/-/%{channel_id}")
base_channel_route = "/channel/:channel_id/:channel_title"
redirect_base = "/chat/c/%{channel_title}/%{channel_id}"
get base_channel_route, to: redirect(redirect_base)
%w[info info/about info/members info/settings].each do |route|
get "#{base_channel_route}/#{route}", to: redirect("#{redirect_base}/#{route}")
end
end end
Discourse::Application.routes.append do Discourse::Application.routes.append do

View File

@ -34,14 +34,14 @@ describe "chat bbcode quoting in posts" do
expect(post.cooked.chomp).to eq(<<~COOKED.chomp) expect(post.cooked.chomp).to eq(<<~COOKED.chomp)
<div class="chat-transcript" data-message-id="2321" data-username="martin" data-datetime="2022-01-25T05:40:39Z" data-channel-name="Cool Cats Club" data-channel-id="1234"> <div class="chat-transcript" data-message-id="2321" data-username="martin" data-datetime="2022-01-25T05:40:39Z" data-channel-name="Cool Cats Club" data-channel-id="1234">
<div class="chat-transcript-meta"> <div class="chat-transcript-meta">
Originally sent in <a href="/chat/channel/1234/-">Cool Cats Club</a> Originally sent in <a href="/chat/c/-/1234">Cool Cats Club</a>
</div> </div>
<div class="chat-transcript-user"> <div class="chat-transcript-user">
<div class="chat-transcript-user-avatar"></div> <div class="chat-transcript-user-avatar"></div>
<div class="chat-transcript-username"> <div class="chat-transcript-username">
martin</div> martin</div>
<div class="chat-transcript-datetime"> <div class="chat-transcript-datetime">
<a href="/chat/channel/1234/-?messageId=2321" title="2022-01-25T05:40:39Z"></a> <a href="/chat/c/-/1234?messageId=2321" title="2022-01-25T05:40:39Z"></a>
</div> </div>
</div> </div>
<div class="chat-transcript-messages"> <div class="chat-transcript-messages">
@ -63,9 +63,9 @@ describe "chat bbcode quoting in posts" do
<div class="chat-transcript-username"> <div class="chat-transcript-username">
martin</div> martin</div>
<div class="chat-transcript-datetime"> <div class="chat-transcript-datetime">
<a href="/chat/channel/1234/-?messageId=2321" title="2022-01-25T05:40:39Z"></a> <a href="/chat/c/-/1234?messageId=2321" title="2022-01-25T05:40:39Z"></a>
</div> </div>
<a class="chat-transcript-channel" href="/chat/channel/1234/-"> <a class="chat-transcript-channel" href="/chat/c/-/1234">
#Cool Cats Club</a> #Cool Cats Club</a>
</div> </div>
<div class="chat-transcript-messages"> <div class="chat-transcript-messages">
@ -87,9 +87,9 @@ describe "chat bbcode quoting in posts" do
<div class="chat-transcript-username"> <div class="chat-transcript-username">
martin</div> martin</div>
<div class="chat-transcript-datetime"> <div class="chat-transcript-datetime">
<a href="/chat/channel/1234/-?messageId=2321" title="2022-01-25T05:40:39Z"></a> <a href="/chat/c/-/1234?messageId=2321" title="2022-01-25T05:40:39Z"></a>
</div> </div>
<a class="chat-transcript-channel" href="/chat/channel/1234/-"> <a class="chat-transcript-channel" href="/chat/c/-/1234">
#Cool Cats Club</a> #Cool Cats Club</a>
</div> </div>
<div class="chat-transcript-messages"> <div class="chat-transcript-messages">
@ -107,7 +107,7 @@ describe "chat bbcode quoting in posts" do
expect(post.cooked.chomp).to eq(<<~COOKED.chomp) expect(post.cooked.chomp).to eq(<<~COOKED.chomp)
<div class="chat-transcript" data-message-id="2321" data-username="martin" data-datetime="2022-01-25T05:40:39Z" data-channel-name="Cool Cats Club" data-channel-id="1234"> <div class="chat-transcript" data-message-id="2321" data-username="martin" data-datetime="2022-01-25T05:40:39Z" data-channel-name="Cool Cats Club" data-channel-id="1234">
<div class="chat-transcript-meta"> <div class="chat-transcript-meta">
Originally sent in <a href="/chat/channel/1234/-">Cool Cats Club</a> Originally sent in <a href="/chat/c/-/1234">Cool Cats Club</a>
</div> </div>
<div class="chat-transcript-user"> <div class="chat-transcript-user">
<div class="chat-transcript-user-avatar"></div> <div class="chat-transcript-user-avatar"></div>
@ -137,9 +137,9 @@ describe "chat bbcode quoting in posts" do
<div class="chat-transcript-username"> <div class="chat-transcript-username">
martin</div> martin</div>
<div class="chat-transcript-datetime"> <div class="chat-transcript-datetime">
<a href="/chat/channel/1234/-?messageId=2321" title="2022-01-25T05:40:39Z"></a> <a href="/chat/c/-/1234?messageId=2321" title="2022-01-25T05:40:39Z"></a>
</div> </div>
<a class="chat-transcript-channel" href="/chat/channel/1234/-"> <a class="chat-transcript-channel" href="/chat/c/-/1234">
#Cool Cats Club</a> #Cool Cats Club</a>
</div> </div>
<div class="chat-transcript-messages"> <div class="chat-transcript-messages">
@ -242,9 +242,9 @@ martin</div>
<div class="chat-transcript-username"> <div class="chat-transcript-username">
#{message1.user.username}</div> #{message1.user.username}</div>
<div class="chat-transcript-datetime"> <div class="chat-transcript-datetime">
<a href="/chat/channel/#{channel.id}/-?messageId=#{message1.id}" title="#{message1.created_at.iso8601}"></a> <a href="/chat/c/-/#{channel.id}?messageId=#{message1.id}" title="#{message1.created_at.iso8601}"></a>
</div> </div>
<a class="chat-transcript-channel" href="/chat/channel/#{channel.id}/-"> <a class="chat-transcript-channel" href="/chat/c/-/#{channel.id}">
##{channel.name}</a> ##{channel.name}</a>
</div> </div>
<div class="chat-transcript-messages"> <div class="chat-transcript-messages">
@ -256,9 +256,9 @@ martin</div>
<div class="chat-transcript-username"> <div class="chat-transcript-username">
#{message2.user.username}</div> #{message2.user.username}</div>
<div class="chat-transcript-datetime"> <div class="chat-transcript-datetime">
<a href="/chat/channel/#{channel.id}/-?messageId=#{message2.id}" title="#{message1.created_at.iso8601}"></a> <a href="/chat/c/-/#{channel.id}?messageId=#{message2.id}" title="#{message1.created_at.iso8601}"></a>
</div> </div>
<a class="chat-transcript-channel" href="/chat/channel/#{channel.id}/-"> <a class="chat-transcript-channel" href="/chat/c/-/#{channel.id}">
##{channel.name}</a> ##{channel.name}</a>
</div> </div>
<div class="chat-transcript-messages"> <div class="chat-transcript-messages">

View File

@ -215,7 +215,7 @@ describe Jobs::ChatNotifyMentioned do
) )
expect(desktop_notification.data[:excerpt]).to eq(message.push_notification_excerpt) expect(desktop_notification.data[:excerpt]).to eq(message.push_notification_excerpt)
expect(desktop_notification.data[:post_url]).to eq( expect(desktop_notification.data[:post_url]).to eq(
"/chat/channel/#{public_channel.id}/#{public_channel.slug}?messageId=#{message.id}", "/chat/c/#{public_channel.slug}/#{public_channel.id}?messageId=#{message.id}",
) )
end end
@ -229,8 +229,7 @@ describe Jobs::ChatNotifyMentioned do
username: user_1.username, username: user_1.username,
tag: Chat::ChatNotifier.push_notification_tag(:mention, public_channel.id), tag: Chat::ChatNotifier.push_notification_tag(:mention, public_channel.id),
excerpt: message.push_notification_excerpt, excerpt: message.push_notification_excerpt,
post_url: post_url: "/chat/c/#{public_channel.slug}/#{public_channel.id}?messageId=#{message.id}",
"/chat/channel/#{public_channel.id}/#{public_channel.slug}?messageId=#{message.id}",
translated_title: payload_translated_title, translated_title: payload_translated_title,
}, },
) )

View File

@ -8,7 +8,7 @@ RSpec.describe ChatChannel do
context "when the slug is nil" do context "when the slug is nil" do
it "uses a - instead" do it "uses a - instead" do
category_channel1.slug = nil category_channel1.slug = nil
expect(category_channel1.relative_url).to eq("/chat/channel/#{category_channel1.id}/-") expect(category_channel1.relative_url).to eq("/chat/c/-/#{category_channel1.id}")
end end
end end
@ -17,7 +17,7 @@ RSpec.describe ChatChannel do
it "includes the slug for the channel" do it "includes the slug for the channel" do
expect(category_channel1.relative_url).to eq( expect(category_channel1.relative_url).to eq(
"/chat/channel/#{category_channel1.id}/some-cool-channel", "/chat/c/some-cool-channel/#{category_channel1.id}",
) )
end end
end end

View File

@ -129,7 +129,7 @@ describe ChatMessage do
expect(cooked).to eq(<<~COOKED.chomp) expect(cooked).to eq(<<~COOKED.chomp)
<div class="chat-transcript chat-transcript-chained" data-message-id="#{msg1.id}" data-username="chatbbcodeuser" data-datetime="#{msg1.created_at.iso8601}" data-channel-name="testchannel" data-channel-id="#{chat_channel.id}"> <div class="chat-transcript chat-transcript-chained" data-message-id="#{msg1.id}" data-username="chatbbcodeuser" data-datetime="#{msg1.created_at.iso8601}" data-channel-name="testchannel" data-channel-id="#{chat_channel.id}">
<div class="chat-transcript-meta"> <div class="chat-transcript-meta">
Originally sent in <a href="/chat/channel/#{chat_channel.id}/-">testchannel</a> Originally sent in <a href="/chat/c/-/#{chat_channel.id}">testchannel</a>
</div> </div>
<div class="chat-transcript-user"> <div class="chat-transcript-user">
<div class="chat-transcript-user-avatar"> <div class="chat-transcript-user-avatar">
@ -138,7 +138,7 @@ describe ChatMessage do
<div class="chat-transcript-username"> <div class="chat-transcript-username">
chatbbcodeuser</div> chatbbcodeuser</div>
<div class="chat-transcript-datetime"> <div class="chat-transcript-datetime">
<a href="/chat/channel/#{chat_channel.id}/-?messageId=#{msg1.id}" title="#{msg1.created_at.iso8601}"></a> <a href="/chat/c/-/#{chat_channel.id}?messageId=#{msg1.id}" title="#{msg1.created_at.iso8601}"></a>
</div> </div>
</div> </div>
<div class="chat-transcript-messages"> <div class="chat-transcript-messages">

View File

@ -144,7 +144,7 @@ describe Chat do
).chat_message ).chat_message
end end
let(:chat_url) { "#{Discourse.base_url}/chat/channel/#{chat_channel.id}" } let(:chat_url) { "#{Discourse.base_url}/chat/c/-/#{chat_channel.id}" }
context "when inline" do context "when inline" do
it "renders channel" do it "renders channel" do
@ -209,7 +209,7 @@ describe Chat do
<div class="chat-transcript-datetime"> <div class="chat-transcript-datetime">
<a href="#{chat_url}?messageId=#{chat_message.id}" title="#{chat_message.created_at}">#{chat_message.created_at}</a> <a href="#{chat_url}?messageId=#{chat_message.id}" title="#{chat_message.created_at}">#{chat_message.created_at}</a>
</div> </div>
<a class="chat-transcript-channel" href="/chat/channel/#{chat_channel.id}/-"> <a class="chat-transcript-channel" href="/chat/c/-/#{chat_channel.id}">
<span class="category-chat-badge" style="color: ##{chat_channel.chatable.color}"> <span class="category-chat-badge" style="color: ##{chat_channel.chatable.color}">
<svg class="fa d-icon d-icon-hashtag svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#hashtag"></use></svg> <svg class="fa d-icon d-icon-hashtag svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#hashtag"></use></svg>
</span> </span>

View File

@ -31,7 +31,7 @@ RSpec.describe "Info pages", type: :system, js: true do
find(".chat-channel-title-wrapper").click find(".chat-channel-title-wrapper").click
find(".chat-full-page-header__back-btn").click find(".chat-full-page-header__back-btn").click
expect(page).to have_current_path(chat.channel_path(channel_1.id, channel_1.slug)) expect(page).to have_current_path(chat.channel_path(channel_1.slug, channel_1.id))
end end
end end
end end

View File

@ -26,9 +26,7 @@ RSpec.describe "Channel - Info - Members page", type: :system, js: true do
it "redirects to about page" do it "redirects to about page" do
chat_page.visit_channel_members(channel_1) chat_page.visit_channel_members(channel_1)
expect(page).to have_current_path( expect(page).to have_current_path("/chat/c/#{channel_1.slug}/#{channel_1.id}/info/about")
"/chat/channel/#{channel_1.id}/#{channel_1.slug}/info/about",
)
end end
end end

View File

@ -25,9 +25,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system, js: true do
it "redirects to about tab" do it "redirects to about tab" do
chat_page.visit_channel_settings(channel_1) chat_page.visit_channel_settings(channel_1)
expect(page).to have_current_path( expect(page).to have_current_path("/chat/c/#{channel_1.slug}/#{channel_1.id}/info/about")
"/chat/channel/#{channel_1.id}/#{channel_1.slug}/info/about",
)
end end
it "doesnt have settings tab" do it "doesnt have settings tab" do
@ -49,7 +47,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system, js: true do
chat_page.visit_channel_settings(channel_1) chat_page.visit_channel_settings(channel_1)
expect(page).to have_current_path( expect(page).to have_current_path(
"/chat/channel/#{channel_1.id}/#{channel_1.slug}/info/settings", "/chat/c/#{channel_1.slug}/#{channel_1.id}/info/settings",
) )
end end
end end

View File

@ -103,7 +103,7 @@ RSpec.describe "Create channel", type: :system, js: true do
expect(page).to have_content(name) expect(page).to have_content(name)
created_channel = ChatChannel.find_by(chatable_id: category_1.id) created_channel = ChatChannel.find_by(chatable_id: category_1.id)
expect(created_channel.slug).to eq("cats-dogs") expect(created_channel.slug).to eq("cats-dogs")
expect(page).to have_current_path(chat.channel_path(created_channel.id, created_channel.slug)) expect(page).to have_current_path(chat.channel_path(created_channel.slug, created_channel.id))
end end
it "allows the user to set a slug independently of name" do it "allows the user to set a slug independently of name" do
@ -119,7 +119,7 @@ RSpec.describe "Create channel", type: :system, js: true do
expect(page).to have_content(name) expect(page).to have_content(name)
created_channel = ChatChannel.find_by(chatable_id: category_1.id) created_channel = ChatChannel.find_by(chatable_id: category_1.id)
expect(created_channel.slug).to eq("pets-everywhere") expect(created_channel.slug).to eq("pets-everywhere")
expect(page).to have_current_path(chat.channel_path(created_channel.id, created_channel.slug)) expect(page).to have_current_path(chat.channel_path(created_channel.slug, created_channel.id))
end end
context "when saving" do context "when saving" do
@ -165,7 +165,7 @@ RSpec.describe "Create channel", type: :system, js: true do
expect(page).to have_content(category_1.name) expect(page).to have_content(category_1.name)
created_channel = ChatChannel.find_by(chatable_id: category_1.id) created_channel = ChatChannel.find_by(chatable_id: category_1.id)
expect(page).to have_current_path( expect(page).to have_current_path(
chat.channel_path(created_channel.id, created_channel.slug), chat.channel_path(created_channel.slug, created_channel.id),
) )
end end
end end

View File

@ -26,8 +26,7 @@ RSpec.describe "Navigating to message", type: :system, js: true do
Fabricate( Fabricate(
:post, :post,
topic: topic_1, topic: topic_1,
raw: raw: "<a href=\"/chat/c/-/#{channel_1.id}?messageId=#{first_message.id}\">#{link}</a>",
"<a href=\"/chat/channel/#{channel_1.id}/-?messageId=#{first_message.id}\">#{link}</a>",
) )
end end
@ -46,7 +45,7 @@ RSpec.describe "Navigating to message", type: :system, js: true do
Fabricate( Fabricate(
:chat_message, :chat_message,
chat_channel: channel_1, chat_channel: channel_1,
message: "[#{link}](/chat/channel/#{channel_1.id}/-?messageId=#{first_message.id})", message: "[#{link}](/chat/c/-/#{channel_1.id}?messageId=#{first_message.id})",
) )
end end
@ -78,7 +77,7 @@ RSpec.describe "Navigating to message", type: :system, js: true do
Fabricate( Fabricate(
:chat_message, :chat_message,
chat_channel: channel_2, chat_channel: channel_2,
message: "[#{link}](/chat/channel/#{channel_1.id}/-?messageId=#{first_message.id})", message: "[#{link}](/chat/c/-/#{channel_1.id}?messageId=#{first_message.id})",
) )
channel_2.add(current_user) channel_2.add(current_user)
end end
@ -94,8 +93,8 @@ RSpec.describe "Navigating to message", type: :system, js: true do
end end
context "when navigating directly to a message link" do context "when navigating directly to a message link" do
it "highlights the correct message" do it "highglights the correct message" do
visit("/chat/channel/#{channel_1.id}/-?messageId=#{first_message.id}") visit("/chat/c/-/#{channel_1.id}?messageId=#{first_message.id}")
expect(page).to have_css( expect(page).to have_css(
".chat-message-container.highlighted[data-id='#{first_message.id}']", ".chat-message-container.highlighted[data-id='#{first_message.id}']",
@ -112,8 +111,7 @@ RSpec.describe "Navigating to message", type: :system, js: true do
Fabricate( Fabricate(
:post, :post,
topic: topic_1, topic: topic_1,
raw: raw: "<a href=\"/chat/c/-/#{channel_1.id}?messageId=#{first_message.id}\">#{link}</a>",
"<a href=\"/chat/channel/#{channel_1.id}/-?messageId=#{first_message.id}\">#{link}</a>",
) )
end end
@ -132,7 +130,7 @@ RSpec.describe "Navigating to message", type: :system, js: true do
Fabricate( Fabricate(
:chat_message, :chat_message,
chat_channel: channel_1, chat_channel: channel_1,
message: "[#{link}](/chat/channel/#{channel_1.id}/-?messageId=#{first_message.id})", message: "[#{link}](/chat/c/-/#{channel_1.id}?messageId=#{first_message.id})",
) )
end end

View File

@ -46,7 +46,7 @@ RSpec.describe "Navigation", type: :system, js: true do
chat_page.open_from_header chat_page.open_from_header
expect(page).to have_current_path( expect(page).to have_current_path(
chat.channel_path(category_channel_2.id, category_channel_2.slug), chat.channel_path(category_channel_2.slug, category_channel_2.id),
) )
end end
end end
@ -56,7 +56,7 @@ RSpec.describe "Navigation", type: :system, js: true do
chat_page.open chat_page.open
expect(page).to have_current_path( expect(page).to have_current_path(
chat.channel_path(category_channel.id, category_channel.slug), chat.channel_path(category_channel.slug, category_channel.id),
) )
expect(page).to have_css("html.has-full-page-chat") expect(page).to have_css("html.has-full-page-chat")
expect(page).to have_css(".chat-message-container[data-id='#{message.id}']") expect(page).to have_css(".chat-message-container[data-id='#{message.id}']")
@ -79,14 +79,14 @@ RSpec.describe "Navigation", type: :system, js: true do
chat_drawer_page.maximize chat_drawer_page.maximize
expect(page).to have_current_path( expect(page).to have_current_path(
chat.channel_path(category_channel.id, category_channel.slug), chat.channel_path(category_channel.slug, category_channel.id),
) )
visit("/") visit("/")
chat_page.open_from_header chat_page.open_from_header
expect(page).to have_current_path( expect(page).to have_current_path(
chat.channel_path(category_channel.id, category_channel.slug), chat.channel_path(category_channel.slug, category_channel.id),
) )
end end
end end
@ -149,7 +149,7 @@ RSpec.describe "Navigation", type: :system, js: true do
find("a[class*='sidebar-section-link-#{category_channel.slug}']").click find("a[class*='sidebar-section-link-#{category_channel.slug}']").click
expect(page).to have_current_path( expect(page).to have_current_path(
chat.channel_path(category_channel.id, category_channel.slug), chat.channel_path(category_channel.slug, category_channel.id),
) )
end end
end end
@ -235,7 +235,7 @@ RSpec.describe "Navigation", type: :system, js: true do
chat_page.open_from_header chat_page.open_from_header
expect(page).to have_current_path( expect(page).to have_current_path(
chat.channel_path(category_channel_2.id, category_channel_2.slug), chat.channel_path(category_channel_2.slug, category_channel_2.id),
) )
expect(page).to have_content(category_channel_2.title) expect(page).to have_content(category_channel_2.title)
end end
@ -243,7 +243,7 @@ RSpec.describe "Navigation", type: :system, js: true do
context "when opening a channel in full page" do context "when opening a channel in full page" do
it "activates the channel in the sidebar" do it "activates the channel in the sidebar" do
visit("/chat/channel/#{category_channel.id}/#{category_channel.slug}") visit("/chat/c/#{category_channel.slug}/#{category_channel.id}")
expect(page).to have_css( expect(page).to have_css(
".sidebar-section-link-#{category_channel.slug}.sidebar-section-link--active", ".sidebar-section-link-#{category_channel.slug}.sidebar-section-link--active",
) )
@ -252,7 +252,7 @@ RSpec.describe "Navigation", type: :system, js: true do
context "when going back to channel from channel settings in full page" do context "when going back to channel from channel settings in full page" do
it "activates the channel in the sidebar" do it "activates the channel in the sidebar" do
visit("/chat/channel/#{category_channel.id}/#{category_channel.slug}/info/settings") visit("/chat/c/#{category_channel.slug}/#{category_channel.id}/info/settings")
find(".chat-full-page-header__back-btn").click find(".chat-full-page-header__back-btn").click
expect(page).to have_content(message.message) expect(page).to have_content(message.message)
end end
@ -260,7 +260,7 @@ RSpec.describe "Navigation", type: :system, js: true do
context "when clicking logo from a channel in full page" do context "when clicking logo from a channel in full page" do
it "deactivates the channel in the sidebar" do it "deactivates the channel in the sidebar" do
visit("/chat/channel/#{category_channel.id}/#{category_channel.slug}") visit("/chat/c/#{category_channel.slug}/#{category_channel.id}")
find("#site-logo").click find("#site-logo").click
expect(page).not_to have_css( expect(page).not_to have_css(

View File

@ -20,11 +20,11 @@ module PageObjects
end end
def open_channel(channel) def open_channel(channel)
find(".sidebar-section-link[href='/chat/channel/#{channel.id}/#{channel.slug}']").click find(".sidebar-section-link[href='/chat/c/#{channel.slug}/#{channel.id}']").click
end end
def find_channel(channel) def find_channel(channel)
find(".sidebar-section-link[href='/chat/channel/#{channel.id}/#{channel.slug}']") find(".sidebar-section-link[href='/chat/c/#{channel.slug}/#{channel.id}']")
self self
end end
end end

View File

@ -37,10 +37,7 @@ RSpec.describe "Sidebar navigation menu", type: :system, js: true do
it "channel link has the correct href" do it "channel link has the correct href" do
visit("/") visit("/")
expect(page).to have_link( expect(page).to have_link(channel_1.name, href: "/chat/c/#{channel_1.slug}/#{channel_1.id}")
channel_1.name,
href: "/chat/channel/#{channel_1.id}/#{channel_1.slug}",
)
end end
context "when the category is private" do context "when the category is private" do

View File

@ -59,7 +59,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true do
end end
expect(find("#quick-access-chat-notifications")).to have_link( expect(find("#quick-access-chat-notifications")).to have_link(
I18n.t("js.notifications.popup.direct_message_chat_mention.direct"), I18n.t("js.notifications.popup.direct_message_chat_mention.direct"),
href: "/chat/channel/#{dm_channel_1.id}/#{other_user.username}?messageId=#{message.id}", href: "/chat/c/#{other_user.username}/#{dm_channel_1.id}?messageId=#{message.id}",
) )
end end
end end
@ -100,7 +100,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true do
identifier: "@#{group.name}", identifier: "@#{group.name}",
channel: channel_1.name, channel: channel_1.name,
), ),
href: "/chat/channel/#{channel_1.id}/#{channel_1.slug}?messageId=#{message.id}", href: "/chat/c/#{channel_1.slug}/#{channel_1.id}?messageId=#{message.id}",
) )
end end
end end
@ -126,7 +126,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true do
expect(find("#quick-access-chat-notifications")).to have_link( expect(find("#quick-access-chat-notifications")).to have_link(
I18n.t("js.notifications.popup.chat_mention.direct", channel: channel_1.name), I18n.t("js.notifications.popup.chat_mention.direct", channel: channel_1.name),
href: "/chat/channel/#{channel_1.id}/#{channel_1.slug}?messageId=#{message.id}", href: "/chat/c/#{channel_1.slug}/#{channel_1.id}?messageId=#{message.id}",
) )
end end
end end
@ -153,7 +153,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true do
identifier: "@all", identifier: "@all",
channel: channel_1.name, channel: channel_1.name,
), ),
href: "/chat/channel/#{channel_1.id}/#{channel_1.slug}?messageId=#{message.id}", href: "/chat/c/#{channel_1.slug}/#{channel_1.id}?messageId=#{message.id}",
) )
end end
end end

View File

@ -61,7 +61,7 @@ RSpec.describe "Visit channel", type: :system, js: true do
context "when channel is not found" do context "when channel is not found" do
it "shows an error" do it "shows an error" do
visit("/chat/channel/999/-") visit("/chat/c/-/999")
expect(page).to have_content("Not Found") # this is not a translated key expect(page).to have_content("Not Found") # this is not a translated key
end end
@ -69,7 +69,7 @@ RSpec.describe "Visit channel", type: :system, js: true do
context "when loading a non existing message of a channel" do context "when loading a non existing message of a channel" do
it "shows an error" do it "shows an error" do
visit("/chat/channel/#{category_channel_1.id}/-?messageId=-999") visit("/chat/c/-/#{category_channel_1.id}?messageId=-999")
expect(page).to have_content(I18n.t("not_found")) expect(page).to have_content(I18n.t("not_found"))
end end
@ -151,10 +151,10 @@ RSpec.describe "Visit channel", type: :system, js: true do
context "when URL doesnt contain slug" do context "when URL doesnt contain slug" do
it "redirects to correct URL" do it "redirects to correct URL" do
visit("/chat/channel/#{category_channel_1.id}/-") visit("/chat/c/-/#{category_channel_1.id}")
expect(page).to have_current_path( expect(page).to have_current_path(
"/chat/channel/#{category_channel_1.id}/#{category_channel_1.slug}", "/chat/c/#{category_channel_1.slug}/#{category_channel_1.id}",
) )
end end
end end
@ -179,10 +179,10 @@ RSpec.describe "Visit channel", type: :system, js: true do
context "when URL doesnt contain slug" do context "when URL doesnt contain slug" do
it "redirects to correct URL" do it "redirects to correct URL" do
visit("/chat/channel/#{dm_channel_1.id}/-") visit("/chat/c/-/#{dm_channel_1.id}")
expect(page).to have_current_path( expect(page).to have_current_path(
"/chat/channel/#{dm_channel_1.id}/#{Slug.for(dm_channel_1.title(current_user))}", "/chat/c/#{Slug.for(dm_channel_1.title(current_user))}/#{dm_channel_1.id}",
) )
end end
end end

View File

@ -45,7 +45,7 @@ acceptance("Discourse Chat - Composer", function (needs) {
}); });
skip("when pasting html in composer", async function (assert) { skip("when pasting html in composer", async function (assert) {
await visit("/chat/channel/11/another-category"); await visit("/chat/c/another-category/11");
const clipboardEvent = new Event("paste", { bubbles: true }); const clipboardEvent = new Event("paste", { bubbles: true });
clipboardEvent.clipboardData = { clipboardEvent.clipboardData = {
@ -96,7 +96,7 @@ acceptance("Discourse Chat - Composer - unreliable network", function (needs) {
}); });
skip("Sending a message with unreliable network", async function (assert) { skip("Sending a message with unreliable network", async function (assert) {
await visit("/chat/channel/11/-"); await visit("/chat/c/-/11");
await fillIn(".chat-composer-input", "network-error-message"); await fillIn(".chat-composer-input", "network-error-message");
await click(".send-btn"); await click(".send-btn");
@ -133,7 +133,7 @@ acceptance("Discourse Chat - Composer - unreliable network", function (needs) {
}); });
skip("Draft with unreliable network", async function (assert) { skip("Draft with unreliable network", async function (assert) {
await visit("/chat/channel/11/-"); await visit("/chat/c/-/11");
this.chatService.set("isNetworkUnreliable", true); this.chatService.set("isNetworkUnreliable", true);
await settled(); await settled();

View File

@ -113,7 +113,7 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
const collapseImage = const collapseImage =
".chat-message-container[data-id='1'] .chat-message-collapser-opened"; ".chat-message-container[data-id='1'] .chat-message-collapser-opened";
await visit("/chat/channel/1/cat"); await visit("/chat/c/cat/1");
assert.ok(visible(youtubeContainer)); assert.ok(visible(youtubeContainer));
assert.ok(visible(collapseImage), "the open arrow is shown"); assert.ok(visible(collapseImage), "the open arrow is shown");
@ -140,7 +140,7 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
const collapseImage = const collapseImage =
".chat-message-container[data-id='2'] .chat-message-collapser-opened"; ".chat-message-container[data-id='2'] .chat-message-collapser-opened";
await visit("/chat/channel/1/cat"); await visit("/chat/c/cat/1");
await click(image); await click(image);

View File

@ -55,7 +55,7 @@ acceptance(
}); });
skip("Handles 429 errors by displaying an alert", async function (assert) { skip("Handles 429 errors by displaying an alert", async function (assert) {
await visit("/chat/channel/1/cat"); await visit("/chat/c/cat/1");
assert.ok(exists(".dialog-content"), "We displayed a 429 error"); assert.ok(exists(".dialog-content"), "We displayed a 429 error");
await click(".dialog-footer .btn-primary"); await click(".dialog-footer .btn-primary");

View File

@ -17,7 +17,10 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {
assert assert
.dom(".chat-channel-row") .dom(".chat-channel-row")
.hasAttribute("href", `/chat/channel/${this.categoryChatChannel.id}/-`); .hasAttribute(
"href",
`/chat/c/${this.categoryChatChannel.slugifiedTitle}/${this.categoryChatChannel.id}`
);
}); });
test("allows tabbing", async function (assert) { test("allows tabbing", async function (assert) {

View File

@ -14,7 +14,7 @@ module("Discourse Chat | Unit | Helpers | format-chat-date", function (hooks) {
assert.equal( assert.equal(
query(".chat-time").getAttribute("href"), query(".chat-time").getAttribute("href"),
"/chat/channel/1/-?messageId=1" "/chat/c/-/1?messageId=1"
); );
}); });
}); });

View File

@ -43,9 +43,9 @@ module(
const data = this.args.data; const data = this.args.data;
assert.strictEqual( assert.strictEqual(
query(".chat-invitation a").getAttribute("href"), query(".chat-invitation a").getAttribute("href"),
`/chat/channel/${data.chat_channel_id}/${slugifyChannel({ `/chat/c/${slugifyChannel({
title: data.chat_channel_title, title: data.chat_channel_title,
})}?messageId=${data.chat_message_id}` })}/${data.chat_channel_id}?messageId=${data.chat_message_id}`
); );
}); });
} }

View File

@ -52,9 +52,9 @@ module(
assert.strictEqual( assert.strictEqual(
query(".chat-invitation a").getAttribute("href"), query(".chat-invitation a").getAttribute("href"),
`/chat/channel/${data.chat_channel_id}/${slugifyChannel({ `/chat/c/${slugifyChannel({
title: data.chat_channel_title, title: data.chat_channel_title,
})}?messageId=${data.chat_message_id}` })}/${data.chat_channel_id}?messageId=${data.chat_message_id}`
); );
}); });
} }
@ -91,9 +91,9 @@ module(
assert.strictEqual( assert.strictEqual(
query(".chat-invitation a").getAttribute("href"), query(".chat-invitation a").getAttribute("href"),
`/chat/channel/${data.chat_channel_id}/${slugifyChannel({ `/chat/c/${slugifyChannel({
title: data.chat_channel_title, title: data.chat_channel_title,
})}?messageId=${data.chat_message_id}` })}/${data.chat_channel_id}?messageId=${data.chat_message_id}`
); );
}); });
} }
@ -130,9 +130,9 @@ module(
assert.strictEqual( assert.strictEqual(
query(".chat-invitation a").getAttribute("href"), query(".chat-invitation a").getAttribute("href"),
`/chat/channel/${data.chat_channel_id}/${slugifyChannel({ `/chat/c/${slugifyChannel({
title: data.chat_channel_title, title: data.chat_channel_title,
})}?messageId=${data.chat_message_id}` })}/${data.chat_channel_id}?messageId=${data.chat_message_id}`
); );
}); });
} }