mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: upgrade transitionToRoute
on Controller (#22647)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods We are upgrading all `this.transitionToRoute` calls on controllers to directly call the router service (`this.router.transitionTo`)
This commit is contained in:
@ -7,8 +7,11 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
|||||||
import { action, get } from "@ember/object";
|
import { action, get } from "@ember/object";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminApiKeysNewController extends Controller {
|
export default class AdminApiKeysNewController extends Controller {
|
||||||
|
@service router;
|
||||||
|
|
||||||
userModes = [
|
userModes = [
|
||||||
{ id: "all", name: I18n.t("admin.api.all_users") },
|
{ id: "all", name: I18n.t("admin.api.all_users") },
|
||||||
{ id: "single", name: I18n.t("admin.api.single_user") },
|
{ id: "single", name: I18n.t("admin.api.single_user") },
|
||||||
@ -76,7 +79,7 @@ export default class AdminApiKeysNewController extends Controller {
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
continue() {
|
continue() {
|
||||||
this.transitionToRoute("adminApiKeys.show", this.model.id);
|
this.router.transitionTo("adminApiKeys.show", this.model.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
@ -5,10 +5,13 @@ import { bufferedProperty } from "discourse/mixins/buffered-content";
|
|||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminApiKeysShowController extends Controller.extend(
|
export default class AdminApiKeysShowController extends Controller.extend(
|
||||||
bufferedProperty("model")
|
bufferedProperty("model")
|
||||||
) {
|
) {
|
||||||
|
@service router;
|
||||||
|
|
||||||
@empty("model.id") isNew;
|
@empty("model.id") isNew;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
@ -53,7 +56,7 @@ export default class AdminApiKeysShowController extends Controller.extend(
|
|||||||
deleteKey(key) {
|
deleteKey(key) {
|
||||||
key
|
key
|
||||||
.destroyRecord()
|
.destroyRecord()
|
||||||
.then(() => this.transitionToRoute("adminApiKeys.index"))
|
.then(() => this.router.transitionTo("adminApiKeys.index"))
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ export default class AdminBadgesShowController extends Controller.extend(
|
|||||||
if (!adminBadges.includes(model)) {
|
if (!adminBadges.includes(model)) {
|
||||||
adminBadges.pushObject(model);
|
adminBadges.pushObject(model);
|
||||||
}
|
}
|
||||||
this.transitionToRoute("adminBadges.show", model.get("id"));
|
this.router.transitionTo("adminBadges.show", model.get("id"));
|
||||||
} else {
|
} else {
|
||||||
this.commitBuffer();
|
this.commitBuffer();
|
||||||
this.savingStatus = I18n.t("saved");
|
this.savingStatus = I18n.t("saved");
|
||||||
@ -237,7 +237,7 @@ export default class AdminBadgesShowController extends Controller.extend(
|
|||||||
.destroy()
|
.destroy()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
adminBadges.removeObject(model);
|
adminBadges.removeObject(model);
|
||||||
this.transitionToRoute("adminBadges.index");
|
this.router.transitionTo("adminBadges.index");
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.dialog.alert(I18n.t("generic_error"));
|
this.dialog.alert(I18n.t("generic_error"));
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
import { sort } from "@ember/object/computed";
|
import { sort } from "@ember/object/computed";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminCustomizeEmailTemplatesController extends Controller {
|
export default class AdminCustomizeEmailTemplatesController extends Controller {
|
||||||
|
@service router;
|
||||||
|
|
||||||
titleSorting = ["title"];
|
titleSorting = ["title"];
|
||||||
@sort("emailTemplates", "titleSorting") sortedTemplates;
|
@sort("emailTemplates", "titleSorting") sortedTemplates;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
onSelectTemplate(template) {
|
onSelectTemplate(template) {
|
||||||
this.transitionToRoute("adminCustomizeEmailTemplates.edit", template);
|
this.router.transitionTo("adminCustomizeEmailTemplates.edit", template);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminCustomizeFormTemplatesIndex extends Controller {
|
export default class AdminCustomizeFormTemplatesIndex extends Controller {
|
||||||
|
@service router;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
newTemplate() {
|
newTemplate() {
|
||||||
this.transitionToRoute("adminCustomizeFormTemplates.new");
|
this.router.transitionTo("adminCustomizeFormTemplates.new");
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
@ -21,6 +21,7 @@ const THEME_UPLOAD_VAR = 2;
|
|||||||
|
|
||||||
export default class AdminCustomizeThemesShowController extends Controller {
|
export default class AdminCustomizeThemesShowController extends Controller {
|
||||||
@service dialog;
|
@service dialog;
|
||||||
|
@service router;
|
||||||
|
|
||||||
editRouteName = "adminCustomizeThemes.edit";
|
editRouteName = "adminCustomizeThemes.edit";
|
||||||
|
|
||||||
@ -226,7 +227,7 @@ export default class AdminCustomizeThemesShowController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
transitionToEditRoute() {
|
transitionToEditRoute() {
|
||||||
this.transitionToRoute(
|
this.router.transitionTo(
|
||||||
this.editRouteName,
|
this.editRouteName,
|
||||||
this.get("model.id"),
|
this.get("model.id"),
|
||||||
"common",
|
"common",
|
||||||
@ -383,7 +384,7 @@ export default class AdminCustomizeThemesShowController extends Controller {
|
|||||||
model.setProperties({ recentlyInstalled: false });
|
model.setProperties({ recentlyInstalled: false });
|
||||||
model.destroyRecord().then(() => {
|
model.destroyRecord().then(() => {
|
||||||
this.allThemes.removeObject(model);
|
this.allThemes.removeObject(model);
|
||||||
this.transitionToRoute("adminCustomizeThemes");
|
this.router.transitionTo("adminCustomizeThemes");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -6,8 +6,11 @@ import { isEmpty } from "@ember/utils";
|
|||||||
import { debounce } from "discourse-common/utils/decorators";
|
import { debounce } from "discourse-common/utils/decorators";
|
||||||
import { observes } from "@ember-decorators/object";
|
import { observes } from "@ember-decorators/object";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default class AdminSiteSettingsController extends Controller {
|
export default class AdminSiteSettingsController extends Controller {
|
||||||
|
@service router;
|
||||||
|
|
||||||
filter = null;
|
filter = null;
|
||||||
|
|
||||||
@alias("model") allSiteSettings;
|
@alias("model") allSiteSettings;
|
||||||
@ -117,7 +120,7 @@ export default class AdminSiteSettingsController extends Controller {
|
|||||||
if (isEmpty(this.filter) && !this.onlyOverridden) {
|
if (isEmpty(this.filter) && !this.onlyOverridden) {
|
||||||
this.set("visibleSiteSettings", this.allSiteSettings);
|
this.set("visibleSiteSettings", this.allSiteSettings);
|
||||||
if (this.categoryNameKey === "all_results") {
|
if (this.categoryNameKey === "all_results") {
|
||||||
this.transitionToRoute("adminSiteSettings");
|
this.router.transitionTo("adminSiteSettings");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -138,7 +141,7 @@ export default class AdminSiteSettingsController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.set("visibleSiteSettings", matchesGroupedByCategory);
|
this.set("visibleSiteSettings", matchesGroupedByCategory);
|
||||||
this.transitionToRoute(
|
this.router.transitionTo(
|
||||||
"adminSiteSettingsCategory",
|
"adminSiteSettingsCategory",
|
||||||
category || "all_results"
|
category || "all_results"
|
||||||
);
|
);
|
||||||
|
@ -2,9 +2,13 @@ import { action } from "@ember/object";
|
|||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import discourseDebounce from "discourse-common/lib/debounce";
|
import discourseDebounce from "discourse-common/lib/debounce";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
let lastSearch;
|
let lastSearch;
|
||||||
|
|
||||||
export default class AdminSiteTextIndexController extends Controller {
|
export default class AdminSiteTextIndexController extends Controller {
|
||||||
|
@service router;
|
||||||
|
@service siteSettings;
|
||||||
|
|
||||||
searching = false;
|
searching = false;
|
||||||
siteTexts = null;
|
siteTexts = null;
|
||||||
preferred = false;
|
preferred = false;
|
||||||
@ -48,7 +52,7 @@ export default class AdminSiteTextIndexController extends Controller {
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
edit(siteText) {
|
edit(siteText) {
|
||||||
this.transitionToRoute("adminSiteText.edit", siteText.get("id"), {
|
this.router.transitionTo("adminSiteText.edit", siteText.get("id"), {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
locale: this.locale,
|
locale: this.locale,
|
||||||
},
|
},
|
||||||
|
@ -9,6 +9,9 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
|||||||
|
|
||||||
export default class AdminWebHooksEditController extends Controller {
|
export default class AdminWebHooksEditController extends Controller {
|
||||||
@service dialog;
|
@service dialog;
|
||||||
|
@service router;
|
||||||
|
@service siteSettings;
|
||||||
|
|
||||||
@controller adminWebHooks;
|
@controller adminWebHooks;
|
||||||
|
|
||||||
@alias("adminWebHooks.eventTypes") eventTypes;
|
@alias("adminWebHooks.eventTypes") eventTypes;
|
||||||
@ -94,7 +97,7 @@ export default class AdminWebHooksEditController extends Controller {
|
|||||||
|
|
||||||
this.set("saved", true);
|
this.set("saved", true);
|
||||||
this.adminWebHooks.model.addObject(this.model);
|
this.adminWebHooks.model.addObject(this.model);
|
||||||
this.transitionToRoute("adminWebHooks.show", this.model);
|
this.router.transitionTo("adminWebHooks.show", this.model);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
popupAjaxError(e);
|
popupAjaxError(e);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ export default class AdminWebHooksShowController extends Controller {
|
|||||||
try {
|
try {
|
||||||
await this.model.destroyRecord();
|
await this.model.destroyRecord();
|
||||||
this.adminWebHooks.model.removeObject(this.model);
|
this.adminWebHooks.model.removeObject(this.model);
|
||||||
this.transitionToRoute("adminWebHooks");
|
this.router.transitionTo("adminWebHooks");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
popupAjaxError(e);
|
popupAjaxError(e);
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@ import Controller from "@ember/controller";
|
|||||||
import { changeEmail } from "discourse/lib/user-activation";
|
import { changeEmail } from "discourse/lib/user-activation";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
router: service(),
|
||||||
accountCreated: null,
|
accountCreated: null,
|
||||||
newEmail: null,
|
newEmail: null,
|
||||||
|
|
||||||
@ -18,13 +20,13 @@ export default Controller.extend({
|
|||||||
changeEmail({ email })
|
changeEmail({ email })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.set("accountCreated.email", email);
|
this.set("accountCreated.email", email);
|
||||||
this.transitionToRoute("account-created.resent");
|
this.router.transitionTo("account-created.resent");
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.transitionToRoute("account-created.index");
|
this.router.transitionTo("account-created.index");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -4,8 +4,10 @@ import getUrl from "discourse-common/lib/get-url";
|
|||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import { resendActivationEmail } from "discourse/lib/user-activation";
|
import { resendActivationEmail } from "discourse/lib/user-activation";
|
||||||
import { wavingHandURL } from "discourse/lib/waving-hand-url";
|
import { wavingHandURL } from "discourse/lib/waving-hand-url";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
router: service(),
|
||||||
envelopeImageUrl: getUrl("/images/envelope.svg"),
|
envelopeImageUrl: getUrl("/images/envelope.svg"),
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed
|
||||||
@ -21,11 +23,11 @@ export default Controller.extend({
|
|||||||
actions: {
|
actions: {
|
||||||
sendActivationEmail() {
|
sendActivationEmail() {
|
||||||
resendActivationEmail(this.get("accountCreated.username")).then(() => {
|
resendActivationEmail(this.get("accountCreated.username")).then(() => {
|
||||||
this.transitionToRoute("account-created.resent");
|
this.router.transitionTo("account-created.resent");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
editActivationEmail() {
|
editActivationEmail() {
|
||||||
this.transitionToRoute("account-created.edit-email");
|
this.router.transitionTo("account-created.edit-email");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -2,8 +2,12 @@ import Controller from "@ember/controller";
|
|||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend(ModalFunctionality, {
|
export default Controller.extend(ModalFunctionality, {
|
||||||
|
router: service(),
|
||||||
|
currentUser: service(),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
finishConnect() {
|
finishConnect() {
|
||||||
ajax({
|
ajax({
|
||||||
@ -12,7 +16,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.transitionToRoute(
|
this.router.transitionTo(
|
||||||
"preferences.account",
|
"preferences.account",
|
||||||
this.currentUser.findDetails()
|
this.currentUser.findDetails()
|
||||||
);
|
);
|
||||||
|
@ -12,6 +12,9 @@ import { inject as service } from "@ember/service";
|
|||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
dialog: service(),
|
dialog: service(),
|
||||||
|
site: service(),
|
||||||
|
router: service(),
|
||||||
|
|
||||||
selectedTab: "general",
|
selectedTab: "general",
|
||||||
saving: false,
|
saving: false,
|
||||||
deleting: false,
|
deleting: false,
|
||||||
@ -109,7 +112,7 @@ export default Controller.extend({
|
|||||||
notification_level: NotificationLevels.REGULAR,
|
notification_level: NotificationLevels.REGULAR,
|
||||||
});
|
});
|
||||||
this.site.updateCategory(model);
|
this.site.updateCategory(model);
|
||||||
this.transitionToRoute("editCategory", Category.slugFor(model));
|
this.router.transitionTo("editCategory", Category.slugFor(model));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@ -126,7 +129,7 @@ export default Controller.extend({
|
|||||||
this.model
|
this.model
|
||||||
.destroy()
|
.destroy()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.transitionToRoute("discovery.categories");
|
this.router.transitionTo("discovery.categories");
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.displayErrors([I18n.t("category.delete_error")]);
|
this.displayErrors([I18n.t("category.delete_error")]);
|
||||||
|
@ -20,6 +20,9 @@ const Tab = EmberObject.extend({
|
|||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
application: controller(),
|
application: controller(),
|
||||||
dialog: service(),
|
dialog: service(),
|
||||||
|
currentUser: service(),
|
||||||
|
router: service(),
|
||||||
|
|
||||||
counts: null,
|
counts: null,
|
||||||
showing: "members",
|
showing: "members",
|
||||||
destroying: null,
|
destroying: null,
|
||||||
@ -146,7 +149,7 @@ export default Controller.extend({
|
|||||||
didConfirm: () => {
|
didConfirm: () => {
|
||||||
model
|
model
|
||||||
.destroy()
|
.destroy()
|
||||||
.then(() => this.transitionToRoute("groups.index"))
|
.then(() => this.router.transitionTo("groups.index"))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -4,8 +4,10 @@ import { INPUT_DELAY } from "discourse-common/config/environment";
|
|||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import discourseDebounce from "discourse-common/lib/debounce";
|
import discourseDebounce from "discourse-common/lib/debounce";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
router: service(),
|
||||||
application: controller(),
|
application: controller(),
|
||||||
queryParams: ["order", "asc", "filter", "type"],
|
queryParams: ["order", "asc", "filter", "type"],
|
||||||
order: null,
|
order: null,
|
||||||
@ -55,7 +57,7 @@ export default Controller.extend({
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
new() {
|
new() {
|
||||||
this.transitionToRoute("groups.new");
|
this.router.transitionTo("groups.new");
|
||||||
},
|
},
|
||||||
|
|
||||||
_debouncedFilter(filter) {
|
_debouncedFilter(filter) {
|
||||||
|
@ -37,6 +37,7 @@ export function popupAutomaticMembershipAlert(group_id, email_domains) {
|
|||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
dialog: service(),
|
dialog: service(),
|
||||||
|
router: service(),
|
||||||
saving: null,
|
saving: null,
|
||||||
|
|
||||||
@discourseComputed("model.ownerUsernames")
|
@discourseComputed("model.ownerUsernames")
|
||||||
@ -62,7 +63,7 @@ export default Controller.extend({
|
|||||||
group
|
group
|
||||||
.create()
|
.create()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.transitionToRoute("group.members", group.name);
|
this.router.transitionTo("group.members", group.name);
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError)
|
.catch(popupAjaxError)
|
||||||
.finally(() => this.set("saving", false));
|
.finally(() => this.set("saving", false));
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import Controller, { inject as controller } from "@ember/controller";
|
import Controller, { inject as controller } from "@ember/controller";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
router: service(),
|
||||||
tagGroups: controller(),
|
tagGroups: controller(),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
@ -8,7 +10,7 @@ export default Controller.extend({
|
|||||||
const tagGroups = this.tagGroups.model;
|
const tagGroups = this.tagGroups.model;
|
||||||
tagGroups.removeObject(this.model);
|
tagGroups.removeObject(this.model);
|
||||||
|
|
||||||
this.transitionToRoute("tagGroups.index");
|
this.router.transitionTo("tagGroups.index");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import Controller, { inject as controller } from "@ember/controller";
|
import Controller, { inject as controller } from "@ember/controller";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
router: service(),
|
||||||
tagGroups: controller(),
|
tagGroups: controller(),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
@ -8,7 +10,7 @@ export default Controller.extend({
|
|||||||
const tagGroups = this.tagGroups.model;
|
const tagGroups = this.tagGroups.model;
|
||||||
tagGroups.pushObject(this.model);
|
tagGroups.pushObject(this.model);
|
||||||
|
|
||||||
this.transitionToRoute("tagGroups.index");
|
this.router.transitionTo("tagGroups.index");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
newTagGroup() {
|
newTagGroup() {
|
||||||
this.transitionToRoute("tagGroups.new");
|
this.router.transitionTo("tagGroups.new");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -19,6 +19,9 @@ export default DiscoverySortableController.extend(
|
|||||||
{
|
{
|
||||||
application: controller(),
|
application: controller(),
|
||||||
dialog: service(),
|
dialog: service(),
|
||||||
|
router: service(),
|
||||||
|
currentUser: service(),
|
||||||
|
siteSettings: service(),
|
||||||
|
|
||||||
tag: null,
|
tag: null,
|
||||||
additionalTags: null,
|
additionalTags: null,
|
||||||
@ -178,7 +181,7 @@ export default DiscoverySortableController.extend(
|
|||||||
didConfirm: () => {
|
didConfirm: () => {
|
||||||
return this.tag
|
return this.tag
|
||||||
.destroyRecord()
|
.destroyRecord()
|
||||||
.then(() => this.transitionToRoute("tags.index"))
|
.then(() => this.router.transitionTo("tags.index"))
|
||||||
.catch(() => this.dialog.alert(I18n.t("generic_error")));
|
.catch(() => this.dialog.alert(I18n.t("generic_error")));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -59,6 +59,11 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||||||
documentTitle: service(),
|
documentTitle: service(),
|
||||||
screenTrack: service(),
|
screenTrack: service(),
|
||||||
modal: service(),
|
modal: service(),
|
||||||
|
currentUser: service(),
|
||||||
|
router: service(),
|
||||||
|
siteSettings: service(),
|
||||||
|
site: service(),
|
||||||
|
appEvents: service(),
|
||||||
|
|
||||||
multiSelect: false,
|
multiSelect: false,
|
||||||
selectedPostIds: null,
|
selectedPostIds: null,
|
||||||
@ -565,7 +570,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||||||
.removeAllowedUser(user)
|
.removeAllowedUser(user)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (this.currentUser.id === user.id) {
|
if (this.currentUser.id === user.id) {
|
||||||
this.transitionToRoute("userPrivateMessages", user);
|
this.router.transitionTo("userPrivateMessages", user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -8,11 +8,13 @@ import Bookmark from "discourse/models/bookmark";
|
|||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
import { htmlSafe } from "@ember/template";
|
import { htmlSafe } from "@ember/template";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
queryParams: ["q"],
|
queryParams: ["q"],
|
||||||
q: null,
|
q: null,
|
||||||
|
|
||||||
|
router: service(),
|
||||||
application: controller(),
|
application: controller(),
|
||||||
user: controller(),
|
user: controller(),
|
||||||
loading: false,
|
loading: false,
|
||||||
@ -51,7 +53,7 @@ export default Controller.extend({
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
search() {
|
search() {
|
||||||
this.transitionToRoute({
|
this.router.transitionTo({
|
||||||
queryParams: { q: this.searchTerm },
|
queryParams: { q: this.searchTerm },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -143,7 +143,7 @@ acceptance("Admin - Site Settings", function (needs) {
|
|||||||
await visit("admin/site_settings/category/basic?filter=menu");
|
await visit("admin/site_settings/category/basic?filter=menu");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
currentURL(),
|
currentURL(),
|
||||||
"admin/site_settings/category/basic?filter=menu"
|
"/admin/site_settings/category/basic?filter=menu"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
import getUrl from "discourse-common/lib/get-url";
|
import getUrl from "discourse-common/lib/get-url";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
|
router: service(),
|
||||||
|
|
||||||
wizard: null,
|
wizard: null,
|
||||||
step: null,
|
step: null,
|
||||||
|
|
||||||
@ -13,14 +16,14 @@ export default Controller.extend({
|
|||||||
if (response?.refresh_required) {
|
if (response?.refresh_required) {
|
||||||
document.location = getUrl(`/wizard/steps/${next}`);
|
document.location = getUrl(`/wizard/steps/${next}`);
|
||||||
} else if (response?.success && next) {
|
} else if (response?.success && next) {
|
||||||
this.transitionToRoute("wizard.step", next);
|
this.router.transitionTo("wizard.step", next);
|
||||||
} else if (response?.success) {
|
} else if (response?.success) {
|
||||||
this.transitionToRoute("discovery.latest");
|
this.router.transitionTo("discovery.latest");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@action
|
@action
|
||||||
goBack() {
|
goBack() {
|
||||||
this.transitionToRoute("wizard.step", this.step.previous);
|
this.router.transitionTo("wizard.step", this.step.previous);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user