A platform for community discussion. Free, open, simple.
DEV: `/channel` -> `/c` chat route rename (#19782)
Roman Rizzid07b472b79af
diff --git a/.byebug_history b/.byebug_historynew file mode 100644index 00000000000..e69de29bb2ddiff --git a/plugins/chat/app/models/chat_channel.rb b/plugins/chat/app/models/chat_channel.rbindex 389a16a4c12..6edd8e52f24 100644--- a/plugins/chat/app/models/chat_channel.rb+++ b/plugins/chat/app/models/chat_channel.rb@@ -76,11 +76,11 @@ class ChatChannel < ActiveRecord::Baseenddef url- "#{Discourse.base_url}/chat/channel/#{self.id}/#{self.slug || "-"}"+ "#{Discourse.base_url}/chat/c/#{self.slug || "-"}/#{self.id}"enddef relative_url- "#{Discourse.base_path}/chat/channel/#{self.id}/#{self.slug || "-"}"+ "#{Discourse.base_path}/chat/c/#{self.slug || "-"}/#{self.id}"enddef self.ensure_consistency!diff --git a/plugins/chat/assets/javascripts/discourse/chat-route-map.js b/plugins/chat/assets/javascripts/discourse/chat-route-map.jsindex 582253f65b5..2ffee549611 100644--- a/plugins/chat/assets/javascripts/discourse/chat-route-map.js+++ b/plugins/chat/assets/javascripts/discourse/chat-route-map.js@@ -1,8 +1,13 @@export default 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("channel",- { path: "/channel/:channelId/:channelTitle" },+ { path: "/c/:channelTitle/:channelId/" },function () {this.route("info", { path: "/info" }, function () {this.route("about", { path: "/about" });diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.hbsindex 05ebec3b06e..5747a77885c 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-about-view.hbs@@ -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>\ No newline at end of filediff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.hbsindex d36800259ee..a7c4b39bb4f 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-card.hbs@@ -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">diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.hbsindex a6562b1b5b7..3d1e442ae8d 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-row.hbs@@ -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")diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel-status.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-channel-status.hbsindex 5bfb42db968..149d1e97606 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel-status.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel-status.hbs@@ -5,4 +5,4 @@<ChatChannelArchiveStatus @channel={{this.channel}} /></div>-{{/if}}+{{/if}}\ No newline at end of filediff --git a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.hbsindex 7d5b8411b59..75626a8ce9a 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.hbs@@ -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">diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.js b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.jsindex df5fb52819e..04c0b39e5e3 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.js+++ b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.js@@ -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";}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.hbsindex bf9154bc6b6..a6a17db58fb 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.hbs@@ -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}}\ No newline at end of filediff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message.js b/plugins/chat/assets/javascripts/discourse/components/chat-message.jsindex 13e46c27f82..4d504c2e2cc 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-message.js+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message.js@@ -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);diff --git a/plugins/chat/assets/javascripts/discourse/components/reviewable-chat-message.hbs b/plugins/chat/assets/javascripts/discourse/components/reviewable-chat-message.hbsindex b3f653bbe0d..004e907d703 100644--- a/plugins/chat/assets/javascripts/discourse/components/reviewable-chat-message.hbs+++ b/plugins/chat/assets/javascripts/discourse/components/reviewable-chat-message.hbs@@ -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 [email protected]_id}}><ChatChannelTitle @channel={{this.chatChannel}} />diff --git a/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js b/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.jsindex 6226d541ed1..58fc361097d 100644--- a/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js+++ b/plugins/chat/assets/javascripts/discourse/helpers/format-chat-date.js@@ -15,7 +15,7 @@ registerUnbound("format-chat-date", function (message, details, mode) {if (details) {url = getURL(- `/chat/channel/${details.chat_channel_id}/-?messageId=${message.id}`+ `/chat/c/-/${details.chat_channel_id}?messageId=${message.id}`);}diff --git a/plugins/chat/assets/javascripts/discourse/helpers/slugify-channel.js b/plugins/chat/assets/javascripts/discourse/helpers/slugify-channel.jsdeleted file mode 100644index adcbee709f7..00000000000--- a/plugins/chat/assets/javascripts/discourse/helpers/slugify-channel.js+++ /dev/null@@ -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]);- }-}diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.jsindex 547632c6c77..1cb408dbaba 100644--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js@@ -1,5 +1,4 @@import { htmlSafe } from "@ember/template";-import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";import { withPluginApi } from "discourse/lib/plugin-api";import I18n from "I18n";import { bind } from "discourse-common/utils/decorators";@@ -32,7 +31,7 @@ export default {}get name() {- return dasherize(slugifyChannel(this.channel));+ return dasherize(this.channel.slugifiedTitle);}@computed("chatService.activeChannel")@@ -57,7 +56,7 @@ export default {}get models() {- return [this.channel.id, slugifyChannel(this.channel)];+ return this.channel.routeModels;}get text() {@@ -195,7 +194,7 @@ export default {}get name() {- return slugifyChannel(this.channel);+ return this.channel.slugifiedTitle;}@computed("chatService.activeChannel")@@ -220,7 +219,7 @@ export default {}get models() {- return [this.channel.id, slugifyChannel(this.channel)];+ return this.channel.routeModels;}get title() {diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-user-menu.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-user-menu.jsindex 62758b9b0c5..484d511dade 100644--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-user-menu.js+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-user-menu.js@@ -24,11 +24,9 @@ export default {title: this.notification.data.chat_channel_title,slug: this.notification.data.chat_channel_slug,});- return `/chat/channel/${+ return `/chat/c/${slug || "-"}/${this.notification.data.chat_channel_id- }/${slug || "-"}?messageId=${- this.notification.data.chat_message_id- }`;+ }?messageId=${this.notification.data.chat_message_id}`;}get linkTitle() {@@ -61,11 +59,9 @@ export default {title: this.notification.data.chat_channel_title,slug: this.notification.data.chat_channel_slug,});- return `/chat/channel/${+ return `/chat/c/${slug || "-"}/${this.notification.data.chat_channel_id- }/${slug || "-"}?messageId=${- this.notification.data.chat_message_id- }`;+ }?messageId=${this.notification.data.chat_message_id}`;}get linkTitle() {diff --git a/plugins/chat/assets/javascripts/discourse/lib/slugify-channel.js b/plugins/chat/assets/javascripts/discourse/lib/slugify-channel.jsindex f7a2734879e..492a25a9ae5 100644--- a/plugins/chat/assets/javascripts/discourse/lib/slugify-channel.js+++ b/plugins/chat/assets/javascripts/discourse/lib/slugify-channel.js@@ -4,6 +4,11 @@ export default function slugifyChannel(channel) {if (channel.slug) {return channel.slug;}++ if (!channel.escapedTitle && !channel.title) {+ return "-";+ }+const slug = slugify(channel.escapedTitle || channel.title);const resolvedSlug = (slug.lengthdiff --git a/plugins/chat/assets/javascripts/discourse/models/chat-channel.js b/plugins/chat/assets/javascripts/discourse/models/chat-channel.jsindex 182b01a1ec3..04a4e97a52d 100644--- a/plugins/chat/assets/javascripts/discourse/models/chat-channel.js+++ b/plugins/chat/assets/javascripts/discourse/models/chat-channel.js@@ -5,6 +5,7 @@ import UserChatChannelMembership from "discourse/plugins/chat/discourse/models/uimport { ajax } from "discourse/lib/ajax";import { escapeExpression } from "discourse/lib/utilities";import { tracked } from "@glimmer/tracking";+import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";export const CHATABLE_TYPES = {directMessageChannel: "DirectMessage",@@ -73,6 +74,14 @@ export default class ChatChannel extends RestModel {return escapeExpression(this.description);}+ get slugifiedTitle() {+ return this.slug || slugifyChannel(this);+ }++ get routeModels() {+ return [this.slugifiedTitle, this.id];+ }+get isDirectMessageChannel() {return this.chatable_type === CHATABLE_TYPES.directMessageChannel;}diff --git a/plugins/chat/assets/javascripts/discourse/routes/chat-channel-legacy.js b/plugins/chat/assets/javascripts/discourse/routes/chat-channel-legacy.jsnew file mode 100644index 00000000000..29c5104d189--- /dev/null+++ b/plugins/chat/assets/javascripts/discourse/routes/chat-channel-legacy.js@@ -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 },+ });+ }+}diff --git a/plugins/chat/assets/javascripts/discourse/routes/chat-channel.js b/plugins/chat/assets/javascripts/discourse/routes/chat-channel.jsindex 152348e1f99..26a547e4bd0 100644--- a/plugins/chat/assets/javascripts/discourse/routes/chat-channel.js+++ b/plugins/chat/assets/javascripts/discourse/routes/chat-channel.js@@ -1,6 +1,5 @@import DiscourseRoute from "discourse/routes/discourse";import { inject as service } from "@ember/service";-import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";import { action } from "@ember/object";import { schedule } from "@ember/runloop";@@ -17,9 +16,8 @@ export default class ChatChannelRoute extends DiscourseRoute {this.chat.setActiveChannel(model);const { channelTitle, messageId } = this.paramsFor(this.routeName);- const slug = slugifyChannel(model);- if (channelTitle !== slug) {- this.router.replaceWith("chat.channel.index", model.id, slug, {+ if (channelTitle !== model.slugifiedTitle) {+ this.router.replaceWith("chat.channel.index", ...model.routeModels, {queryParams: { messageId },});}diff --git a/plugins/chat/assets/javascripts/discourse/routes/chat-message.js b/plugins/chat/assets/javascripts/discourse/routes/chat-message.jsindex c96d913c092..810822e1897 100644--- a/plugins/chat/assets/javascripts/discourse/routes/chat-message.js+++ b/plugins/chat/assets/javascripts/discourse/routes/chat-message.js@@ -11,8 +11,8 @@ export default class ChatMessageRoute extends DiscourseRoute {.then((response) => {this.transitionTo("chat.channel",- response.chat_channel_id,response.chat_channel_title,+ response.chat_channel_id,{queryParams: { messageId: params.messageId },}diff --git a/plugins/chat/assets/javascripts/discourse/services/chat-notification-manager.js b/plugins/chat/assets/javascripts/discourse/services/chat-notification-manager.jsindex 686c552515b..396f16cf400 100644--- a/plugins/chat/assets/javascripts/discourse/services/chat-notification-manager.js+++ b/plugins/chat/assets/javascripts/discourse/services/chat-notification-manager.js@@ -57,7 +57,7 @@ export default class ChatNotificationManager extends Service {@bind_pageChanged(path) {- this.set("_inChat", path.startsWith("/chat/channel/"));+ this.set("_inChat", path.startsWith("/chat/c/"));if (this._inChat) {this._chatPresenceChannel.enter({ onlyWhileActive: false });this._corePresenceChannel.leave();diff --git a/plugins/chat/assets/javascripts/discourse/services/chat.js b/plugins/chat/assets/javascripts/discourse/services/chat.jsindex 931f480e438..4d6ad20f44e 100644--- a/plugins/chat/assets/javascripts/discourse/services/chat.js+++ b/plugins/chat/assets/javascripts/discourse/services/chat.js@@ -1,4 +1,3 @@-import slugifyChannel from "discourse/plugins/chat/discourse/lib/slugify-channel";import deprecated from "discourse-common/lib/deprecated";import userSearch from "discourse/lib/user-search";import { popupAjaxError } from "discourse/lib/ajax-error";@@ -297,8 +296,8 @@ export default class Chat extends Service {return this.router.transitionTo("chat.channel",+ channel.slugifiedTitle,channel.id,- slugifyChannel(channel),{ queryParams });} else {diff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-about.hbs b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-about.hbsindex e7c3b8d6a47..83de81608a8 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-about.hbs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info-about.hbs@@ -2,4 +2,4 @@@channel={{this.model}}@onEditChatChannelName={{action "onEditChatChannelName"}}@onEditChatChannelDescription={{action "onEditChatChannelDescription"}}-/>+/>\ No newline at end of filediff --git a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info.hbs b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info.hbsindex 83e6b2e8a85..e390f0a194c 100644--- a/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info.hbs+++ b/plugins/chat/assets/javascripts/discourse/templates/chat-channel-info.hbs@@ -13,7 +13,7 @@{{else}}<LinkTo@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"title={{i18n "chat.channel_info.back_to_channel"}}>@@ -38,7 +38,7 @@><LinkTo@route={{concat "chat.channel.info." tab}}- @models={{array this.model.id (slugify-channel this.model)}}+ @models={{this.model.routeModels}}class="chat-tabs-list__link"><span>{{i18n (concat "chat.channel_info.tabs." tab)}}</span>@@ -62,4 +62,4 @@{{outlet}}</div></div>-</div>+</div>\ No newline at end of filediff --git a/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-name.hbs b/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-name.hbsindex 00492a25217..fffffe406c7 100644--- a/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-name.hbs+++ b/plugins/chat/assets/javascripts/discourse/templates/modal/chat-channel-edit-name.hbs@@ -19,4 +19,4 @@@disabled={{this.isSaveDisabled}}/><DModalCancel @close={{route-action "closeModal"}} />-</div>+</div>\ No newline at end of filediff --git a/plugins/chat/assets/javascripts/discourse/templates/modal/create-channel.hbs b/plugins/chat/assets/javascripts/discourse/templates/modal/create-channel.hbsindex c25dc4e63b6..ae6e068897a 100644--- a/plugins/chat/assets/javascripts/discourse/templates/modal/create-channel.hbs+++ b/plugins/chat/assets/javascripts/discourse/templates/modal/create-channel.hbs@@ -85,4 +85,4 @@@label="chat.create_channel.create"@disabled={{this.createDisabled}}/>-</div>+</div>\ No newline at end of filediff --git a/plugins/chat/assets/javascripts/discourse/widgets/chat-invitation-notification-item.js b/plugins/chat/assets/javascripts/discourse/widgets/chat-invitation-notification-item.jsindex f9367adec4a..f85ceb6c5c3 100644--- a/plugins/chat/assets/javascripts/discourse/widgets/chat-invitation-notification-item.js+++ b/plugins/chat/assets/javascripts/discourse/widgets/chat-invitation-notification-item.js@@ -38,7 +38,7 @@ createWidgetFrom(DefaultNotificationItem, "chat-invitation-notification-item", {title: data.chat_channel_title,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}`;},diff --git a/plugins/chat/assets/javascripts/discourse/widgets/chat-mention-notification-item.js b/plugins/chat/assets/javascripts/discourse/widgets/chat-mention-notification-item.jsindex 7d194879dc2..2cb6f373f7b 100644--- a/plugins/chat/assets/javascripts/discourse/widgets/chat-mention-notification-item.js+++ b/plugins/chat/assets/javascripts/discourse/widgets/chat-mention-notification-item.js@@ -48,7 +48,7 @@ const chatNotificationItem = {title: data.chat_channel_title,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}`;},diff --git a/plugins/chat/assets/javascripts/lib/discourse-markdown/chat-transcript.js b/plugins/chat/assets/javascripts/lib/discourse-markdown/chat-transcript.jsindex 236277a62fb..d853a045408 100644--- a/plugins/chat/assets/javascripts/lib/discourse-markdown/chat-transcript.js+++ b/plugins/chat/assets/javascripts/lib/discourse-markdown/chat-transcript.js@@ -21,7 +21,7 @@ const chatTranscriptRule = {const channelName = tagInfo.attrs.channel;const channelId = tagInfo.attrs.channelId;const channelLink = channelId- ? options.getURL(`/chat/channel/${channelId}/-`)+ ? options.getURL(`/chat/c/-/${channelId}`): null;if (!username || !messageIdStart || !messageTimeStart) {diff --git a/plugins/chat/lib/onebox/templates/discourse_chat.mustache b/plugins/chat/lib/onebox/templates/discourse_chat.mustacheindex b0bcc8ef5e8..af7955ed903 100644--- a/plugins/chat/lib/onebox/templates/discourse_chat.mustache+++ b/plugins/chat/lib/onebox/templates/discourse_chat.mustache@@ -39,7 +39,7 @@<div class="chat-transcript-datetime"><a href="{{url}}" title="{{created_at}}">{{created_at}}</a></div>- <a class="chat-transcript-channel" href="/chat/channel/{{channel_id}}/-">+ <a class="chat-transcript-channel" href="/chat/c/-/{{channel_id}}">{{#is_category}}<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>diff --git a/plugins/chat/plugin.rb b/plugins/chat/plugin.rbindex 10e0cb4d3f7..af905b1d727 100644--- a/plugins/chat/plugin.rb+++ b/plugins/chat/plugin.rb@@ -631,12 +631,6 @@ after_initialize doget "/browse/open" => "chat#respond"get "/browse/archived" => "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 "/disable" => "chat#disable_chat"post "/dismiss-retention-reminder" => "chat#dismiss_retention_reminder"@@ -657,6 +651,25 @@ after_initialize dopost "/:chat_channel_id" => "chat#create_message"put "/flag" => "chat#flag"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}")+ endendDiscourse::Application.routes.append dodiff --git a/plugins/chat/spec/integration/post_chat_quote_spec.rb b/plugins/chat/spec/integration/post_chat_quote_spec.rbindex a49ae55665f..ce14c313443 100644--- a/plugins/chat/spec/integration/post_chat_quote_spec.rb+++ b/plugins/chat/spec/integration/post_chat_quote_spec.rb@@ -34,14 +34,14 @@ describe "chat bbcode quoting in posts" doexpect(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-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 class="chat-transcript-user"><div class="chat-transcript-user-avatar"></div><div class="chat-transcript-username">martin</div><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 class="chat-transcript-messages">@@ -63,9 +63,9 @@ describe "chat bbcode quoting in posts" do<div class="chat-transcript-username">martin</div><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>- <a class="chat-transcript-channel" href="/chat/channel/1234/-">+ <a class="chat-transcript-channel" href="/chat/c/-/1234">#Cool Cats Club</a></div><div class="chat-transcript-messages">@@ -87,9 +87,9 @@ describe "chat bbcode quoting in posts" do<div class="chat-transcript-username">martin</div><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>- <a class="chat-transcript-channel" href="/chat/channel/1234/-">+ <a class="chat-transcript-channel" href="/chat/c/-/1234">#Cool Cats Club</a></div><div class="chat-transcript-messages">@@ -107,7 +107,7 @@ describe "chat bbcode quoting in posts" doexpect(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-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 class="chat-transcript-user"><div class="chat-transcript-user-avatar"></div>@@ -137,9 +137,9 @@ describe "chat bbcode quoting in posts" do<div class="chat-transcript-username">martin</div><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>- <a class="chat-transcript-channel" href="/chat/channel/1234/-">+ <a class="chat-transcript-channel" href="/chat/c/-/1234">#Cool Cats Club</a></div><div class="chat-transcript-messages">@@ -242,9 +242,9 @@ martin</div><div class="chat-transcript-username">#{message1.user.username}</div><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>-<a class="chat-transcript-channel" href="/chat/channel/#{channel.id}/-">+<a class="chat-transcript-channel" href="/chat/c/-/#{channel.id}">##{channel.name}</a></div><div class="chat-transcript-messages">@@ -256,9 +256,9 @@ martin</div><div class="chat-transcript-username">#{message2.user.username}</div><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>-<a class="chat-transcript-channel" href="/chat/channel/#{channel.id}/-">+<a class="chat-transcript-channel" href="/chat/c/-/#{channel.id}">##{channel.name}</a></div><div class="chat-transcript-messages">diff --git a/plugins/chat/spec/jobs/regular/chat_notify_mentioned_spec.rb b/plugins/chat/spec/jobs/regular/chat_notify_mentioned_spec.rbindex 32204adc9cd..5fe55080999 100644--- a/plugins/chat/spec/jobs/regular/chat_notify_mentioned_spec.rb+++ b/plugins/chat/spec/jobs/regular/chat_notify_mentioned_spec.rb@@ -215,7 +215,7 @@ describe Jobs::ChatNotifyMentioned do)expect(desktop_notification.data[:excerpt]).to eq(message.push_notification_excerpt)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@@ -229,8 +229,7 @@ describe Jobs::ChatNotifyMentioned dousername: user_1.username,tag: Chat::ChatNotifier.push_notification_tag(:mention, public_channel.id),excerpt: message.push_notification_excerpt,- post_url:- "/chat/channel/#{public_channel.id}/#{public_channel.slug}?messageId=#{message.id}",+ post_url: "/chat/c/#{public_channel.slug}/#{public_channel.id}?messageId=#{message.id}",translated_title: payload_translated_title,},)diff --git a/plugins/chat/spec/models/chat_channel_spec.rb b/plugins/chat/spec/models/chat_channel_spec.rbindex 06d12125106..8cb1a96d587 100644--- a/plugins/chat/spec/models/chat_channel_spec.rb+++ b/plugins/chat/spec/models/chat_channel_spec.rb@@ -8,7 +8,7 @@ RSpec.describe ChatChannel docontext "when the slug is nil" doit "uses a - instead" docategory_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}")endend@@ -17,7 +17,7 @@ RSpec.describe ChatChannel doit "includes the slug for the channel" doexpect(category_channel1.relative_url).to eq(- "/chat/channel/#{category_channel1.id}/some-cool-channel",+ "/chat/c/some-cool-channel/#{category_channel1.id}",)endenddiff --git a/plugins/chat/spec/models/chat_message_spec.rb b/plugins/chat/spec/models/chat_message_spec.rbindex c73b1a24315..fd775b984aa 100644--- a/plugins/chat/spec/models/chat_message_spec.rb+++ b/plugins/chat/spec/models/chat_message_spec.rb@@ -129,7 +129,7 @@ describe ChatMessage doexpect(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-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 class="chat-transcript-user"><div class="chat-transcript-user-avatar">@@ -138,7 +138,7 @@ describe ChatMessage do<div class="chat-transcript-username">chatbbcodeuser</div><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 class="chat-transcript-messages">diff --git a/plugins/chat/spec/plugin_spec.rb b/plugins/chat/spec/plugin_spec.rbindex 431d1ccc616..6a23fe258de 100644--- a/plugins/chat/spec/plugin_spec.rb+++ b/plugins/chat/spec/plugin_spec.rb@@ -144,7 +144,7 @@ describe Chat do).chat_messageend- 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" doit "renders channel" do@@ -209,7 +209,7 @@ describe Chat do<div class="chat-transcript-datetime"><a href="#{chat_url}?messageId=#{chat_message.id}" title="#{chat_message.created_at}">#{chat_message.created_at}</a></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}"><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>diff --git a/plugins/chat/spec/system/channel_info_pages_spec.rb b/plugins/chat/spec/system/channel_info_pages_spec.rbindex 64fb8b8da26..f7992326723 100644--- a/plugins/chat/spec/system/channel_info_pages_spec.rb+++ b/plugins/chat/spec/system/channel_info_pages_spec.rb@@ -31,7 +31,7 @@ RSpec.describe "Info pages", type: :system, js: true dofind(".chat-channel-title-wrapper").clickfind(".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))endendenddiff --git a/plugins/chat/spec/system/channel_members_page_spec.rb b/plugins/chat/spec/system/channel_members_page_spec.rbindex 952a45df592..f044a3dbc61 100644--- a/plugins/chat/spec/system/channel_members_page_spec.rb+++ b/plugins/chat/spec/system/channel_members_page_spec.rb@@ -26,9 +26,7 @@ RSpec.describe "Channel - Info - Members page", type: :system, js: true doit "redirects to about page" dochat_page.visit_channel_members(channel_1)- expect(page).to have_current_path(- "/chat/channel/#{channel_1.id}/#{channel_1.slug}/info/about",- )+ expect(page).to have_current_path("/chat/c/#{channel_1.slug}/#{channel_1.id}/info/about")endenddiff --git a/plugins/chat/spec/system/channel_settings_page_spec.rb b/plugins/chat/spec/system/channel_settings_page_spec.rbindex 83df778c4fc..7d3be3038a0 100644--- a/plugins/chat/spec/system/channel_settings_page_spec.rb+++ b/plugins/chat/spec/system/channel_settings_page_spec.rb@@ -25,9 +25,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system, js: true doit "redirects to about tab" dochat_page.visit_channel_settings(channel_1)- expect(page).to have_current_path(- "/chat/channel/#{channel_1.id}/#{channel_1.slug}/info/about",- )+ expect(page).to have_current_path("/chat/c/#{channel_1.slug}/#{channel_1.id}/info/about")endit "doesn’t have settings tab" do@@ -49,7 +47,7 @@ RSpec.describe "Channel - Info - Settings page", type: :system, js: true dochat_page.visit_channel_settings(channel_1)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",)endenddiff --git a/plugins/chat/spec/system/create_channel_spec.rb b/plugins/chat/spec/system/create_channel_spec.rbindex 8cf0d19d999..294683dec1c 100644--- a/plugins/chat/spec/system/create_channel_spec.rb+++ b/plugins/chat/spec/system/create_channel_spec.rb@@ -103,7 +103,7 @@ RSpec.describe "Create channel", type: :system, js: true doexpect(page).to have_content(name)created_channel = ChatChannel.find_by(chatable_id: category_1.id)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))endit "allows the user to set a slug independently of name" do@@ -119,7 +119,7 @@ RSpec.describe "Create channel", type: :system, js: true doexpect(page).to have_content(name)created_channel = ChatChannel.find_by(chatable_id: category_1.id)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))endcontext "when saving" do@@ -165,7 +165,7 @@ RSpec.describe "Create channel", type: :system, js: true doexpect(page).to have_content(category_1.name)created_channel = ChatChannel.find_by(chatable_id: category_1.id)expect(page).to have_current_path(- chat.channel_path(created_channel.id, created_channel.slug),+ chat.channel_path(created_channel.slug, created_channel.id),)endenddiff --git a/plugins/chat/spec/system/navigating_to_message_spec.rb b/plugins/chat/spec/system/navigating_to_message_spec.rbindex 64d6f75ccba..3b5fe12398d 100644--- a/plugins/chat/spec/system/navigating_to_message_spec.rb+++ b/plugins/chat/spec/system/navigating_to_message_spec.rb@@ -26,8 +26,7 @@ RSpec.describe "Navigating to message", type: :system, js: true doFabricate(:post,topic: topic_1,- raw:- "<a href=\"/chat/channel/#{channel_1.id}/-?messageId=#{first_message.id}\">#{link}</a>",+ raw: "<a href=\"/chat/c/-/#{channel_1.id}?messageId=#{first_message.id}\">#{link}</a>",)end@@ -46,7 +45,7 @@ RSpec.describe "Navigating to message", type: :system, js: true doFabricate(:chat_message,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@@ -78,7 +77,7 @@ RSpec.describe "Navigating to message", type: :system, js: true doFabricate(:chat_message,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)end@@ -94,8 +93,8 @@ RSpec.describe "Navigating to message", type: :system, js: true doendcontext "when navigating directly to a message link" do- it "highlights the correct message" do- visit("/chat/channel/#{channel_1.id}/-?messageId=#{first_message.id}")+ it "highglights the correct message" do+ visit("/chat/c/-/#{channel_1.id}?messageId=#{first_message.id}")expect(page).to have_css(".chat-message-container.highlighted[data-id='#{first_message.id}']",@@ -112,8 +111,7 @@ RSpec.describe "Navigating to message", type: :system, js: true doFabricate(:post,topic: topic_1,- raw:- "<a href=\"/chat/channel/#{channel_1.id}/-?messageId=#{first_message.id}\">#{link}</a>",+ raw: "<a href=\"/chat/c/-/#{channel_1.id}?messageId=#{first_message.id}\">#{link}</a>",)end@@ -132,7 +130,7 @@ RSpec.describe "Navigating to message", type: :system, js: true doFabricate(:chat_message,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})",)enddiff --git a/plugins/chat/spec/system/navigation_spec.rb b/plugins/chat/spec/system/navigation_spec.rbindex e9ee13b565f..559c9a4c2e3 100644--- a/plugins/chat/spec/system/navigation_spec.rb+++ b/plugins/chat/spec/system/navigation_spec.rb@@ -46,7 +46,7 @@ RSpec.describe "Navigation", type: :system, js: true dochat_page.open_from_headerexpect(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),)endend@@ -56,7 +56,7 @@ RSpec.describe "Navigation", type: :system, js: true dochat_page.openexpect(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(".chat-message-container[data-id='#{message.id}']")@@ -79,14 +79,14 @@ RSpec.describe "Navigation", type: :system, js: true dochat_drawer_page.maximizeexpect(page).to have_current_path(- chat.channel_path(category_channel.id, category_channel.slug),+ chat.channel_path(category_channel.slug, category_channel.id),)visit("/")chat_page.open_from_headerexpect(page).to have_current_path(- chat.channel_path(category_channel.id, category_channel.slug),+ chat.channel_path(category_channel.slug, category_channel.id),)endend@@ -149,7 +149,7 @@ RSpec.describe "Navigation", type: :system, js: true dofind("a[class*='sidebar-section-link-#{category_channel.slug}']").clickexpect(page).to have_current_path(- chat.channel_path(category_channel.id, category_channel.slug),+ chat.channel_path(category_channel.slug, category_channel.id),)endend@@ -235,7 +235,7 @@ RSpec.describe "Navigation", type: :system, js: true dochat_page.open_from_headerexpect(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)end@@ -243,7 +243,7 @@ RSpec.describe "Navigation", type: :system, js: true docontext "when opening a channel in full page" doit "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(".sidebar-section-link-#{category_channel.slug}.sidebar-section-link--active",)@@ -252,7 +252,7 @@ RSpec.describe "Navigation", type: :system, js: true docontext "when going back to channel from channel settings in full page" doit "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").clickexpect(page).to have_content(message.message)end@@ -260,7 +260,7 @@ RSpec.describe "Navigation", type: :system, js: true docontext "when clicking logo from a channel in full page" doit "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").clickexpect(page).not_to have_css(diff --git a/plugins/chat/spec/system/page_objects/sidebar/sidebar.rb b/plugins/chat/spec/system/page_objects/sidebar/sidebar.rbindex ededff5373b..bac01c87286 100644--- a/plugins/chat/spec/system/page_objects/sidebar/sidebar.rb+++ b/plugins/chat/spec/system/page_objects/sidebar/sidebar.rb@@ -20,11 +20,11 @@ module PageObjectsenddef 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}']").clickenddef 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}']")selfendenddiff --git a/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb b/plugins/chat/spec/system/sidebar_navigation_menu_spec.rbindex bdbde125752..90ae2001d79 100644--- a/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb+++ b/plugins/chat/spec/system/sidebar_navigation_menu_spec.rb@@ -37,10 +37,7 @@ RSpec.describe "Sidebar navigation menu", type: :system, js: true doit "channel link has the correct href" dovisit("/")- expect(page).to have_link(- channel_1.name,- href: "/chat/channel/#{channel_1.id}/#{channel_1.slug}",- )+ expect(page).to have_link(channel_1.name, href: "/chat/c/#{channel_1.slug}/#{channel_1.id}")endcontext "when the category is private" dodiff --git a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rbindex 6dfbff7105a..6adb92ab675 100644--- a/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb+++ b/plugins/chat/spec/system/user_menu_notifications/sidebar_spec.rb@@ -59,7 +59,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true doendexpect(find("#quick-access-chat-notifications")).to have_link(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}",)endend@@ -100,7 +100,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true doidentifier: "@#{group.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}",)endend@@ -126,7 +126,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true doexpect(find("#quick-access-chat-notifications")).to have_link(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}",)endend@@ -153,7 +153,7 @@ RSpec.describe "User menu notifications | sidebar", type: :system, js: true doidentifier: "@all",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}",)endenddiff --git a/plugins/chat/spec/system/visit_channel_spec.rb b/plugins/chat/spec/system/visit_channel_spec.rbindex 6aad666d0dd..1fe73fad66b 100644--- a/plugins/chat/spec/system/visit_channel_spec.rb+++ b/plugins/chat/spec/system/visit_channel_spec.rb@@ -61,7 +61,7 @@ RSpec.describe "Visit channel", type: :system, js: true docontext "when channel is not found" doit "shows an error" do- visit("/chat/channel/999/-")+ visit("/chat/c/-/999")expect(page).to have_content("Not Found") # this is not a translated keyend@@ -69,7 +69,7 @@ RSpec.describe "Visit channel", type: :system, js: true docontext "when loading a non existing message of a channel" doit "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"))end@@ -151,10 +151,10 @@ RSpec.describe "Visit channel", type: :system, js: true docontext "when URL doesn’t contain slug" doit "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(- "/chat/channel/#{category_channel_1.id}/#{category_channel_1.slug}",+ "/chat/c/#{category_channel_1.slug}/#{category_channel_1.id}",)endend@@ -179,10 +179,10 @@ RSpec.describe "Visit channel", type: :system, js: true docontext "when URL doesn’t contain slug" doit "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(- "/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}",)endenddiff --git a/plugins/chat/test/javascripts/acceptance/chat-composer-test.js b/plugins/chat/test/javascripts/acceptance/chat-composer-test.jsindex 40f6d2386d5..1f8fcf38462 100644--- a/plugins/chat/test/javascripts/acceptance/chat-composer-test.js+++ b/plugins/chat/test/javascripts/acceptance/chat-composer-test.js@@ -45,7 +45,7 @@ acceptance("Discourse Chat - Composer", function (needs) {});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 });clipboardEvent.clipboardData = {@@ -96,7 +96,7 @@ acceptance("Discourse Chat - Composer - unreliable network", function (needs) {});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 click(".send-btn");@@ -133,7 +133,7 @@ acceptance("Discourse Chat - Composer - unreliable network", function (needs) {});skip("Draft with unreliable network", async function (assert) {- await visit("/chat/channel/11/-");+ await visit("/chat/c/-/11");this.chatService.set("isNetworkUnreliable", true);await settled();diff --git a/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js b/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.jsindex 3874fb8b3a8..4674ac50722 100644--- a/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js+++ b/plugins/chat/test/javascripts/acceptance/chat-live-pane-collapse-test.js@@ -113,7 +113,7 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {const collapseImage =".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(collapseImage), "the open arrow is shown");@@ -140,7 +140,7 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {const collapseImage =".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);diff --git a/plugins/chat/test/javascripts/acceptance/chat-live-pane-test.js b/plugins/chat/test/javascripts/acceptance/chat-live-pane-test.jsindex acbf425896d..8a17d2f2039 100644--- a/plugins/chat/test/javascripts/acceptance/chat-live-pane-test.js+++ b/plugins/chat/test/javascripts/acceptance/chat-live-pane-test.js@@ -55,7 +55,7 @@ acceptance(});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");await click(".dialog-footer .btn-primary");diff --git a/plugins/chat/test/javascripts/components/chat-channel-row-test.js b/plugins/chat/test/javascripts/components/chat-channel-row-test.jsindex 357c6c7366f..0c10cad2158 100644--- a/plugins/chat/test/javascripts/components/chat-channel-row-test.js+++ b/plugins/chat/test/javascripts/components/chat-channel-row-test.js@@ -17,7 +17,10 @@ module("Discourse Chat | Component | chat-channel-row", function (hooks) {assert.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) {diff --git a/plugins/chat/test/javascripts/unit/helpers/format-chat-date-test.js b/plugins/chat/test/javascripts/unit/helpers/format-chat-date-test.jsindex fc974208893..e6fe904aabd 100644--- a/plugins/chat/test/javascripts/unit/helpers/format-chat-date-test.js+++ b/plugins/chat/test/javascripts/unit/helpers/format-chat-date-test.js@@ -14,7 +14,7 @@ module("Discourse Chat | Unit | Helpers | format-chat-date", function (hooks) {assert.equal(query(".chat-time").getAttribute("href"),- "/chat/channel/1/-?messageId=1"+ "/chat/c/-/1?messageId=1");});});diff --git a/plugins/chat/test/javascripts/widgets/chat-invitation-notification-item-test.js b/plugins/chat/test/javascripts/widgets/chat-invitation-notification-item-test.jsindex 8e850d9f8ff..862cfaeada6 100644--- a/plugins/chat/test/javascripts/widgets/chat-invitation-notification-item-test.js+++ b/plugins/chat/test/javascripts/widgets/chat-invitation-notification-item-test.js@@ -43,9 +43,9 @@ module(const data = this.args.data;assert.strictEqual(query(".chat-invitation a").getAttribute("href"),- `/chat/channel/${data.chat_channel_id}/${slugifyChannel({+ `/chat/c/${slugifyChannel({title: data.chat_channel_title,- })}?messageId=${data.chat_message_id}`+ })}/${data.chat_channel_id}?messageId=${data.chat_message_id}`);});}diff --git a/plugins/chat/test/javascripts/widgets/chat-mention-notification-item-test.js b/plugins/chat/test/javascripts/widgets/chat-mention-notification-item-test.jsindex 65532c33b10..62603da1be1 100644--- a/plugins/chat/test/javascripts/widgets/chat-mention-notification-item-test.js+++ b/plugins/chat/test/javascripts/widgets/chat-mention-notification-item-test.js@@ -52,9 +52,9 @@ module(assert.strictEqual(query(".chat-invitation a").getAttribute("href"),- `/chat/channel/${data.chat_channel_id}/${slugifyChannel({+ `/chat/c/${slugifyChannel({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(query(".chat-invitation a").getAttribute("href"),- `/chat/channel/${data.chat_channel_id}/${slugifyChannel({+ `/chat/c/${slugifyChannel({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(query(".chat-invitation a").getAttribute("href"),- `/chat/channel/${data.chat_channel_id}/${slugifyChannel({+ `/chat/c/${slugifyChannel({title: data.chat_channel_title,- })}?messageId=${data.chat_message_id}`+ })}/${data.chat_channel_id}?messageId=${data.chat_message_id}`);});}