mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Intercept old channel URLs in drawer mode (#20043)
This commit is contained in:
parent
a4c68d4a2e
commit
7441864474
@ -211,6 +211,17 @@ export default Component.extend({
|
|||||||
URL || this.chatStateManager.lastKnownChatURL
|
URL || this.chatStateManager.lastKnownChatURL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let highlightCb = null;
|
||||||
|
|
||||||
|
if (route.queryParams.messageId) {
|
||||||
|
highlightCb = () => {
|
||||||
|
this.appEvents.trigger(
|
||||||
|
"chat-live-pane:highlight-message",
|
||||||
|
route.queryParams.messageId
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
switch (route.name) {
|
switch (route.name) {
|
||||||
case "chat":
|
case "chat":
|
||||||
this.set("view", LIST_VIEW);
|
this.set("view", LIST_VIEW);
|
||||||
@ -221,25 +232,26 @@ export default Component.extend({
|
|||||||
this.appEvents.trigger("chat:float-toggled", false);
|
this.appEvents.trigger("chat:float-toggled", false);
|
||||||
return;
|
return;
|
||||||
case "chat.channel":
|
case "chat.channel":
|
||||||
return this.chatChannelsManager
|
return this._openChannel(route, highlightCb);
|
||||||
.find(route.params.channelId)
|
case "chat.channel-legacy":
|
||||||
.then((channel) => {
|
return this._openChannel(route, highlightCb);
|
||||||
this.chat.setActiveChannel(channel);
|
|
||||||
this.set("view", CHAT_VIEW);
|
|
||||||
this.appEvents.trigger("chat:float-toggled", false);
|
|
||||||
|
|
||||||
if (route.queryParams.messageId) {
|
|
||||||
schedule("afterRender", () => {
|
|
||||||
this.appEvents.trigger(
|
|
||||||
"chat-live-pane:highlight-message",
|
|
||||||
route.queryParams.messageId
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_openChannel(route, afterRenderFunc = null) {
|
||||||
|
return this.chatChannelsManager
|
||||||
|
.find(route.params.channelId)
|
||||||
|
.then((channel) => {
|
||||||
|
this.chat.setActiveChannel(channel);
|
||||||
|
this.set("view", CHAT_VIEW);
|
||||||
|
this.appEvents.trigger("chat:float-toggled", false);
|
||||||
|
|
||||||
|
if (afterRenderFunc) {
|
||||||
|
schedule("afterRender", afterRenderFunc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
@action
|
@action
|
||||||
openInFullPage() {
|
openInFullPage() {
|
||||||
this.chatStateManager.storeAppURL();
|
this.chatStateManager.storeAppURL();
|
||||||
|
@ -16,6 +16,7 @@ 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);
|
||||||
|
|
||||||
if (channelTitle !== model.slugifiedTitle) {
|
if (channelTitle !== model.slugifiedTitle) {
|
||||||
this.router.replaceWith("chat.channel.index", ...model.routeModels, {
|
this.router.replaceWith("chat.channel.index", ...model.routeModels, {
|
||||||
queryParams: { messageId },
|
queryParams: { messageId },
|
||||||
|
@ -23,6 +23,7 @@ export default class ChatRoute extends DiscourseRoute {
|
|||||||
const INTERCEPTABLE_ROUTES = [
|
const INTERCEPTABLE_ROUTES = [
|
||||||
"chat.channel.index",
|
"chat.channel.index",
|
||||||
"chat.channel",
|
"chat.channel",
|
||||||
|
"chat.channel-legacy",
|
||||||
"chat",
|
"chat",
|
||||||
"chat.index",
|
"chat.index",
|
||||||
"chat.draft-channel",
|
"chat.draft-channel",
|
||||||
@ -36,7 +37,10 @@ export default class ChatRoute extends DiscourseRoute {
|
|||||||
transition.abort();
|
transition.abort();
|
||||||
|
|
||||||
let URL = transition.intent.url;
|
let URL = transition.intent.url;
|
||||||
if (transition.targetName.startsWith("chat.channel")) {
|
if (
|
||||||
|
transition.targetName.startsWith("chat.channel") ||
|
||||||
|
transition.targetName.startsWith("chat.channel-legacy")
|
||||||
|
) {
|
||||||
URL ??= this.router.urlFor(
|
URL ??= this.router.urlFor(
|
||||||
transition.targetName,
|
transition.targetName,
|
||||||
...transition.intent.contexts
|
...transition.intent.contexts
|
||||||
|
Loading…
Reference in New Issue
Block a user