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:
@@ -5,6 +5,7 @@ import UserChatChannelMembership from "discourse/plugins/chat/discourse/models/u
|
||||
import { 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user