DEV: Revert "DEV: Update replaceWith on Route (#22645)" (#22693)

This reverts commit 33db93c9b2.
This commit is contained in:
Isaac Janzen
2023-07-19 10:47:31 -05:00
committed by GitHub
parent 341acacba8
commit 1561e51a13
37 changed files with 52 additions and 134 deletions

View File

@@ -1,13 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
export default class ChatBrowseIndexRoute extends DiscourseRoute {
@service router;
@service siteSettings;
afterModel() {
if (!this.siteSettings.chat_allow_archiving_channels) {
this.router.replaceWith("chat.browse");
this.replaceWith("chat.browse");
}
}
}

View File

@@ -18,6 +18,6 @@ export default class ChatBrowseIndexRoute extends DiscourseRoute {
}
afterModel() {
this.router.replaceWith("chat.browse.open");
this.replaceWith("chat.browse.open");
}
}

View File

@@ -1,12 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
export default class ChatChannelInfoAboutRoute extends DiscourseRoute {
@service router;
afterModel(model) {
if (model.isDirectMessageChannel) {
this.router.replaceWith("chat.channel.info.index");
this.replaceWith("chat.channel.info.index");
}
}
}

View File

@@ -1,18 +1,15 @@
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
export default class ChatChannelInfoIndexRoute extends DiscourseRoute {
@service router;
afterModel(model) {
if (model.isDirectMessageChannel) {
if (model.isOpen && model.membershipsCount >= 1) {
this.router.replaceWith("chat.channel.info.members");
this.replaceWith("chat.channel.info.members");
} else {
this.router.replaceWith("chat.channel.info.settings");
this.replaceWith("chat.channel.info.settings");
}
} else {
this.router.replaceWith("chat.channel.info.about");
this.replaceWith("chat.channel.info.about");
}
}
}

View File

@@ -1,16 +1,13 @@
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
export default class ChatChannelInfoMembersRoute extends DiscourseRoute {
@service router;
afterModel(model) {
if (!model.isOpen) {
return this.router.replaceWith("chat.channel.info.settings");
return this.replaceWith("chat.channel.info.settings");
}
if (model.membershipsCount < 1) {
return this.router.replaceWith("chat.channel.info");
return this.replaceWith("chat.channel.info");
}
}
}

View File

@@ -1,13 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
export default class ChatChannelInfoSettingsRoute extends DiscourseRoute {
@service router;
@service currentUser;
afterModel(model) {
if (!this.currentUser?.staff && !model.currentUserMembership?.following) {
this.router.replaceWith("chat.channel.info");
this.replaceWith("chat.channel.info");
}
}
}

View File

@@ -17,7 +17,7 @@ export default class ChatMessageRoute extends DiscourseRoute {
params.messageId
);
})
.catch(() => this.router.replaceWith("/404"));
.catch(() => this.replaceWith("/404"));
}
beforeModel() {