mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 08:56:36 +08:00
DEV: Update transitionTo
on Route (#22644)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods We are upgrading all `this.transitionTo` calls on routes to directly call the router service (`this.router.transitionTo`)
This commit is contained in:
parent
bd7e5c15fb
commit
011ba5b9f6
|
@ -1,7 +1,10 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminApiIndexRoute extends Route {
|
export default class AdminApiIndexRoute extends Route {
|
||||||
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.transitionTo("adminApiKeys");
|
this.router.transitionTo("adminApiKeys");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminApiKeysRoute extends Route {
|
export default class AdminApiKeysRoute extends Route {
|
||||||
|
@service router;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
show(apiKey) {
|
show(apiKey) {
|
||||||
this.transitionTo("adminApiKeys.show", apiKey.id);
|
this.router.transitionTo("adminApiKeys.show", apiKey.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
new() {
|
new() {
|
||||||
this.transitionTo("adminApiKeys.new");
|
this.router.transitionTo("adminApiKeys.new");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ const LOG_CHANNEL = "/admin/backups/logs";
|
||||||
|
|
||||||
export default class AdminBackupsRoute extends DiscourseRoute {
|
export default class AdminBackupsRoute extends DiscourseRoute {
|
||||||
@service dialog;
|
@service dialog;
|
||||||
|
@service router;
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
this.messageBus.subscribe(LOG_CHANNEL, this.onMessage);
|
this.messageBus.subscribe(LOG_CHANNEL, this.onMessage);
|
||||||
|
@ -71,7 +72,7 @@ export default class AdminBackupsRoute extends DiscourseRoute {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
startBackup(withUploads) {
|
startBackup(withUploads) {
|
||||||
this.transitionTo("admin.backups.logs");
|
this.router.transitionTo("admin.backups.logs");
|
||||||
Backup.start(withUploads).then((result) => {
|
Backup.start(withUploads).then((result) => {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
this.dialog.alert(result.message);
|
this.dialog.alert(result.message);
|
||||||
|
@ -100,7 +101,7 @@ export default class AdminBackupsRoute extends DiscourseRoute {
|
||||||
this.dialog.yesNoConfirm({
|
this.dialog.yesNoConfirm({
|
||||||
message: I18n.t("admin.backups.operations.restore.confirm"),
|
message: I18n.t("admin.backups.operations.restore.confirm"),
|
||||||
didConfirm: () => {
|
didConfirm: () => {
|
||||||
this.transitionTo("admin.backups.logs");
|
this.router.transitionTo("admin.backups.logs");
|
||||||
backup.restore();
|
backup.restore();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminCustomizeEmailTemplatesRoute extends Route {
|
export default class AdminCustomizeEmailTemplatesRoute extends Route {
|
||||||
|
@service router;
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.store.findAll("email-template");
|
return this.store.findAll("email-template");
|
||||||
}
|
}
|
||||||
|
@ -17,7 +20,7 @@ export default class AdminCustomizeEmailTemplatesRoute extends Route {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!editController.emailTemplate) {
|
if (!editController.emailTemplate) {
|
||||||
this.transitionTo(
|
this.router.transitionTo(
|
||||||
"adminCustomizeEmailTemplates.edit",
|
"adminCustomizeEmailTemplates.edit",
|
||||||
this.controller.get("sortedTemplates.firstObject")
|
this.controller.get("sortedTemplates.firstObject")
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminCustomizeIndexRoute extends Route {
|
export default class AdminCustomizeIndexRoute extends Route {
|
||||||
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (this.currentUser.admin) {
|
if (this.currentUser.admin) {
|
||||||
this.transitionTo("adminCustomizeThemes");
|
this.router.transitionTo("adminCustomizeThemes");
|
||||||
} else {
|
} else {
|
||||||
this.transitionTo("adminWatchedWords");
|
this.router.transitionTo("adminWatchedWords");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import Route from "@ember/routing/route";
|
||||||
|
|
||||||
export default class AdminCustomizeThemesEditRoute extends Route {
|
export default class AdminCustomizeThemesEditRoute extends Route {
|
||||||
@service dialog;
|
@service dialog;
|
||||||
|
@service router;
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
const all = this.modelFor("adminCustomizeThemes");
|
const all = this.modelFor("adminCustomizeThemes");
|
||||||
|
@ -32,11 +33,11 @@ export default class AdminCustomizeThemesEditRoute extends Route {
|
||||||
.get("fields")
|
.get("fields")
|
||||||
[wrapper.target].map((f) => f.name);
|
[wrapper.target].map((f) => f.name);
|
||||||
if (wrapper.model.remote_theme && wrapper.model.remote_theme.is_git) {
|
if (wrapper.model.remote_theme && wrapper.model.remote_theme.is_git) {
|
||||||
this.transitionTo("adminCustomizeThemes.index");
|
this.router.transitionTo("adminCustomizeThemes.index");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!fields.includes(wrapper.field_name)) {
|
if (!fields.includes(wrapper.field_name)) {
|
||||||
this.transitionTo(
|
this.router.transitionTo(
|
||||||
"adminCustomizeThemes.edit",
|
"adminCustomizeThemes.edit",
|
||||||
wrapper.model.id,
|
wrapper.model.id,
|
||||||
wrapper.target,
|
wrapper.target,
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { next } from "@ember/runloop";
|
||||||
|
|
||||||
export default class AdminCustomizeThemesRoute extends Route {
|
export default class AdminCustomizeThemesRoute extends Route {
|
||||||
@service dialog;
|
@service dialog;
|
||||||
|
@service router;
|
||||||
|
|
||||||
queryParams = {
|
queryParams = {
|
||||||
repoUrl: null,
|
repoUrl: null,
|
||||||
|
@ -54,7 +55,7 @@ export default class AdminCustomizeThemesRoute extends Route {
|
||||||
addTheme(theme) {
|
addTheme(theme) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
theme.setProperties({ recentlyInstalled: true });
|
theme.setProperties({ recentlyInstalled: true });
|
||||||
this.transitionTo("adminCustomizeThemes.show", theme.get("id"), {
|
this.router.transitionTo("adminCustomizeThemes.show", theme.get("id"), {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
repoName: null,
|
repoName: null,
|
||||||
repoUrl: null,
|
repoUrl: null,
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminLogsIndexRoute extends DiscourseRoute {
|
export default class AdminLogsIndexRoute extends DiscourseRoute {
|
||||||
|
@service router;
|
||||||
|
|
||||||
redirect() {
|
redirect() {
|
||||||
this.transitionTo("adminLogs.staffActionLogs");
|
this.router.transitionTo("adminLogs.staffActionLogs");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import EmberObject, { action } from "@ember/object";
|
import EmberObject, { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminLogsStaffActionLogsRoute extends DiscourseRoute {
|
export default class AdminLogsStaffActionLogsRoute extends DiscourseRoute {
|
||||||
|
@service router;
|
||||||
|
|
||||||
queryParams = {
|
queryParams = {
|
||||||
filters: { refreshModel: true },
|
filters: { refreshModel: true },
|
||||||
};
|
};
|
||||||
|
@ -36,7 +39,7 @@ export default class AdminLogsStaffActionLogsRoute extends DiscourseRoute {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
onFiltersChange(filters) {
|
onFiltersChange(filters) {
|
||||||
this.transitionTo("adminLogs.staffActionLogs", {
|
this.router.transitionTo("adminLogs.staffActionLogs", {
|
||||||
queryParams: { filters },
|
queryParams: { filters },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminPluginsRoute extends Route {
|
export default class AdminPluginsRoute extends Route {
|
||||||
|
@service router;
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.store.findAll("plugin");
|
return this.store.findAll("plugin");
|
||||||
}
|
}
|
||||||
|
@ -9,15 +12,17 @@ export default class AdminPluginsRoute extends Route {
|
||||||
@action
|
@action
|
||||||
showSettings(plugin) {
|
showSettings(plugin) {
|
||||||
const controller = this.controllerFor("adminSiteSettings");
|
const controller = this.controllerFor("adminSiteSettings");
|
||||||
this.transitionTo("adminSiteSettingsCategory", "plugins").then(() => {
|
this.router
|
||||||
if (plugin) {
|
.transitionTo("adminSiteSettingsCategory", "plugins")
|
||||||
// filterContent() is normally on a debounce from typing.
|
.then(() => {
|
||||||
// Because we don't want the default of "All Results", we tell it
|
if (plugin) {
|
||||||
// to skip the next debounce.
|
// filterContent() is normally on a debounce from typing.
|
||||||
controller.set("filter", `plugin:${plugin.id}`);
|
// Because we don't want the default of "All Results", we tell it
|
||||||
controller.set("_skipBounce", true);
|
// to skip the next debounce.
|
||||||
controller.filterContentNow("plugins");
|
controller.set("filter", `plugin:${plugin.id}`);
|
||||||
}
|
controller.set("_skipBounce", true);
|
||||||
});
|
controller.filterContentNow("plugins");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminReportsIndexRoute extends DiscourseRoute {
|
export default class AdminReportsIndexRoute extends DiscourseRoute {
|
||||||
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.transitionTo("admin.dashboardReports");
|
this.router.transitionTo("admin.dashboardReports");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminReportsShowRoute extends DiscourseRoute {
|
export default class AdminReportsShowRoute extends DiscourseRoute {
|
||||||
|
@service router;
|
||||||
|
|
||||||
queryParams = {
|
queryParams = {
|
||||||
start_date: { refreshModel: true },
|
start_date: { refreshModel: true },
|
||||||
end_date: { refreshModel: true },
|
end_date: { refreshModel: true },
|
||||||
|
@ -68,6 +71,6 @@ export default class AdminReportsShowRoute extends DiscourseRoute {
|
||||||
: null,
|
: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.transitionTo("adminReports.show", { queryParams });
|
this.router.transitionTo("adminReports.show", { queryParams });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminUsersIndexRoute extends DiscourseRoute {
|
export default class AdminUsersIndexRoute extends DiscourseRoute {
|
||||||
|
@service router;
|
||||||
|
|
||||||
redirect() {
|
redirect() {
|
||||||
this.transitionTo("adminUsersList");
|
this.router.transitionTo("adminUsersList");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminUsersListIndexRoute extends DiscourseRoute {
|
export default class AdminUsersListIndexRoute extends DiscourseRoute {
|
||||||
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.transitionTo("adminUsersList.show", "active");
|
this.router.transitionTo("adminUsersList.show", "active");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,11 @@ import AdminUser from "admin/models/admin-user";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { exportEntity } from "discourse/lib/export-csv";
|
import { exportEntity } from "discourse/lib/export-csv";
|
||||||
import { outputExportResult } from "discourse/lib/export-result";
|
import { outputExportResult } from "discourse/lib/export-result";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminUsersListRoute extends DiscourseRoute {
|
export default class AdminUsersListRoute extends DiscourseRoute {
|
||||||
|
@service router;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
exportUsers() {
|
exportUsers() {
|
||||||
exportEntity("user_list", {
|
exportEntity("user_list", {
|
||||||
|
@ -14,7 +17,7 @@ export default class AdminUsersListRoute extends DiscourseRoute {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
sendInvites() {
|
sendInvites() {
|
||||||
this.transitionTo("userInvited", this.currentUser);
|
this.router.transitionTo("userInvited", this.currentUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
|
|
@ -45,6 +45,7 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
|
||||||
composer: service(),
|
composer: service(),
|
||||||
modal: service(),
|
modal: service(),
|
||||||
loadingSlider: service(),
|
loadingSlider: service(),
|
||||||
|
router: service(),
|
||||||
|
|
||||||
@action
|
@action
|
||||||
loading(transition) {
|
loading(transition) {
|
||||||
|
@ -124,7 +125,7 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xhrOrErr && xhrOrErr.status === 404) {
|
if (xhrOrErr && xhrOrErr.status === 404) {
|
||||||
return this.transitionTo("exception-unknown");
|
return this.router.transitionTo("exception-unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
exceptionController.setProperties({
|
exceptionController.setProperties({
|
||||||
|
|
|
@ -11,8 +11,11 @@ import { hash } from "rsvp";
|
||||||
import { next } from "@ember/runloop";
|
import { next } from "@ember/runloop";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import Session from "discourse/models/session";
|
import Session from "discourse/models/session";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
||||||
|
router: service(),
|
||||||
|
|
||||||
renderTemplate() {
|
renderTemplate() {
|
||||||
this.render("navigation/categories", { outlet: "navigation-bar" });
|
this.render("navigation/categories", { outlet: "navigation-bar" });
|
||||||
this.render("discovery/categories", { outlet: "list-container" });
|
this.render("discovery/categories", { outlet: "list-container" });
|
||||||
|
@ -144,7 +147,7 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
createCategory() {
|
createCategory() {
|
||||||
this.transitionTo("newCategory");
|
this.router.transitionTo("newCategory");
|
||||||
},
|
},
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
const group = this.modelFor("group");
|
const group = this.modelFor("group");
|
||||||
if (group.can_see_members) {
|
if (group.can_see_members) {
|
||||||
this.transitionTo("group.activity.posts");
|
this.router.transitionTo("group.activity.posts");
|
||||||
} else {
|
} else {
|
||||||
this.transitionTo("group.activity.mentions");
|
this.router.transitionTo("group.activity.mentions");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
// cannot configure IMAP without SMTP being enabled
|
// cannot configure IMAP without SMTP being enabled
|
||||||
if (!this.siteSettings.enable_smtp) {
|
if (!this.siteSettings.enable_smtp) {
|
||||||
return this.transitionTo("group.manage.profile");
|
return this.router.transitionTo("group.manage.profile");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.transitionTo("group.manage.profile");
|
this.router.transitionTo("group.manage.profile");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
|
@ -18,7 +20,7 @@ export default DiscourseRoute.extend({
|
||||||
(!(this.modelFor("group").can_admin_group && group.get("automatic")) &&
|
(!(this.modelFor("group").can_admin_group && group.get("automatic")) &&
|
||||||
!this.currentUser.canManageGroup(group))
|
!this.currentUser.canManageGroup(group))
|
||||||
) {
|
) {
|
||||||
this.transitionTo("group.members", group);
|
this.router.transitionTo("group.members", group);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.transitionTo("group.index");
|
this.router.transitionTo("group.index");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.transitionTo("group.messages.inbox");
|
this.router.transitionTo("group.messages.inbox");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.messages");
|
return I18n.t("groups.messages");
|
||||||
},
|
},
|
||||||
|
@ -16,7 +19,7 @@ export default DiscourseRoute.extend({
|
||||||
!group.get("is_group_user") &&
|
!group.get("is_group_user") &&
|
||||||
!(this.currentUser && this.currentUser.admin)
|
!(this.currentUser && this.currentUser.admin)
|
||||||
) {
|
) {
|
||||||
this.transitionTo("group.members", group);
|
this.router.transitionTo("group.members", group);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,10 @@ import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { buildPermissionDescription } from "discourse/models/permission-type";
|
import { buildPermissionDescription } from "discourse/models/permission-type";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
|
@ -23,7 +25,7 @@ export default DiscourseRoute.extend({
|
||||||
return { permissions };
|
return { permissions };
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.transitionTo("group.members", group);
|
this.router.transitionTo("group.members", group);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import Group from "discourse/models/group";
|
import Group from "discourse/models/group";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
|
@ -23,7 +25,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
afterModel() {
|
afterModel() {
|
||||||
if (!this.get("currentUser.can_create_group")) {
|
if (!this.get("currentUser.can_create_group")) {
|
||||||
this.transitionTo("groups");
|
this.router.transitionTo("groups");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default RestrictedUserRoute.extend({
|
||||||
|
router: service(),
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
|
|
||||||
redirect() {
|
redirect() {
|
||||||
this.transitionTo("preferences.account");
|
this.router.transitionTo("preferences.account");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (!this.siteSettings.tagging_enabled) {
|
if (!this.siteSettings.tagging_enabled) {
|
||||||
this.transitionTo("tagGroups");
|
this.router.transitionTo("tagGroups");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,11 @@ import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import Tag from "discourse/models/tag";
|
import Tag from "discourse/models/tag";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.store.findAll("tag").then((result) => {
|
return this.store.findAll("tag").then((result) => {
|
||||||
if (result.extras) {
|
if (result.extras) {
|
||||||
|
@ -43,7 +46,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showTagGroups() {
|
showTagGroups() {
|
||||||
this.transitionTo("tagGroups");
|
this.router.transitionTo("tagGroups");
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.transitionTo("tag.show", this.paramsFor("tags.legacyRedirect").tag_id);
|
this.router.transitionTo(
|
||||||
|
"tag.show",
|
||||||
|
this.paramsFor("tags.legacyRedirect").tag_id
|
||||||
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
queryParams: {
|
queryParams: {
|
||||||
q: { replace: true },
|
q: { replace: true },
|
||||||
},
|
},
|
||||||
|
|
||||||
redirect() {
|
redirect() {
|
||||||
this.transitionTo("userActivity.bookmarks");
|
this.router.transitionTo("userActivity.bookmarks");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { emojiUnescape } from "discourse/lib/text";
|
import { emojiUnescape } from "discourse/lib/text";
|
||||||
import { escapeExpression } from "discourse/lib/utilities";
|
import { escapeExpression } from "discourse/lib/utilities";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.username = this.modelFor("user").username_lower;
|
this.username = this.modelFor("user").username_lower;
|
||||||
},
|
},
|
||||||
|
@ -42,7 +45,7 @@ export default DiscourseRoute.extend({
|
||||||
_handleCountChange(count) {
|
_handleCountChange(count) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
this.transitionTo("userActivity");
|
this.router.transitionTo("userActivity");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
const { currentUser } = this;
|
const { currentUser } = this;
|
||||||
const viewingMe =
|
const viewingMe =
|
||||||
|
@ -14,7 +17,7 @@ export default DiscourseRoute.extend({
|
||||||
if (this.site.mobileView) {
|
if (this.site.mobileView) {
|
||||||
this.replaceWith(destination);
|
this.replaceWith(destination);
|
||||||
} else {
|
} else {
|
||||||
this.transitionTo(destination);
|
this.router.transitionTo(destination);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
router: service(),
|
||||||
controllerName: "user-notifications",
|
controllerName: "user-notifications",
|
||||||
templateName: "user/notifications-index",
|
templateName: "user/notifications-index",
|
||||||
|
|
||||||
|
@ -11,7 +13,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
this.transitionTo("userNotifications.responses");
|
this.router.transitionTo("userNotifications.responses");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class extends DiscourseRoute {
|
export default class extends DiscourseRoute {
|
||||||
|
@service router;
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
return this.modelFor("user")
|
return this.modelFor("user")
|
||||||
.get("groups")
|
.get("groups")
|
||||||
|
@ -11,7 +14,7 @@ export default class extends DiscourseRoute {
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
this.transitionTo("exception-unknown");
|
this.router.transitionTo("exception-unknown");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,11 @@ import { defaultHomepage } from "discourse/lib/utilities";
|
||||||
export default class ChatBrowseIndexRoute extends DiscourseRoute {
|
export default class ChatBrowseIndexRoute extends DiscourseRoute {
|
||||||
@service chat;
|
@service chat;
|
||||||
@service siteSettings;
|
@service siteSettings;
|
||||||
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (!this.siteSettings.enable_public_channels) {
|
if (!this.siteSettings.enable_public_channels) {
|
||||||
return this.transitionTo(`discovery.${defaultHomepage()}`);
|
return this.router.transitionTo(`discovery.${defaultHomepage()}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@ import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class ChatDraftChannelRoute extends DiscourseRoute {
|
export default class ChatDraftChannelRoute extends DiscourseRoute {
|
||||||
@service chat;
|
@service chat;
|
||||||
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (!this.chat.userCanDirectMessage) {
|
if (!this.chat.userCanDirectMessage) {
|
||||||
this.transitionTo("chat");
|
this.router.transitionTo("chat");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,12 @@ import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class ChatMessageRoute extends DiscourseRoute {
|
export default class ChatMessageRoute extends DiscourseRoute {
|
||||||
@service chat;
|
@service chat;
|
||||||
|
@service router;
|
||||||
|
|
||||||
async model(params) {
|
async model(params) {
|
||||||
return ajax(`/chat/message/${params.messageId}.json`)
|
return ajax(`/chat/message/${params.messageId}.json`)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.transitionTo(
|
this.router.transitionTo(
|
||||||
"chat.channel.near-message",
|
"chat.channel.near-message",
|
||||||
response.chat_channel_title,
|
response.chat_channel_title,
|
||||||
response.chat_channel_id,
|
response.chat_channel_id,
|
||||||
|
@ -21,7 +22,7 @@ export default class ChatMessageRoute extends DiscourseRoute {
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (!this.chat.userCanChat) {
|
if (!this.chat.userCanChat) {
|
||||||
return this.transitionTo(`discovery.${defaultHomepage()}`);
|
return this.router.transitionTo(`discovery.${defaultHomepage()}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,13 @@ import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class PreferencesChatRoute extends RestrictedUserRoute {
|
export default class PreferencesChatRoute extends RestrictedUserRoute {
|
||||||
@service chat;
|
@service chat;
|
||||||
|
@service router;
|
||||||
|
|
||||||
showFooter = true;
|
showFooter = true;
|
||||||
|
|
||||||
setupController(controller, user) {
|
setupController(controller, user) {
|
||||||
if (!user?.can_chat && !this.currentUser.admin) {
|
if (!user?.can_chat && !this.currentUser.admin) {
|
||||||
return this.transitionTo(`discovery.${defaultHomepage()}`);
|
return this.router.transitionTo(`discovery.${defaultHomepage()}`);
|
||||||
}
|
}
|
||||||
controller.set("model", user);
|
controller.set("model", user);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user