DEV: migrate (almost all) routes from actions: to @action syntax (#14722)

This should be safe, all these places are pretty straightforward. I've run into one problem when changing this, though. That problem was fixed in https://github.com/discourse/discourse/pull/14624
This commit is contained in:
Andrei Prigorshnev
2021-11-30 17:01:06 +04:00
committed by GitHub
parent 88f9bb3dc9
commit 284ab8cdf7
19 changed files with 338 additions and 320 deletions

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse"; 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 { action } from "@ember/object";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
model() { model() {
@ -36,10 +37,9 @@ export default DiscourseRoute.extend({
return I18n.t("about.simple_title"); return I18n.t("about.simple_title");
}, },
actions: { @action
didTransition() { didTransition() {
this.controllerFor("application").set("showFooter", true); this.controllerFor("application").set("showFooter", true);
return true; return true;
},
}, },
}); });

View File

@ -1,14 +1,14 @@
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 { action } from "@ember/object";
export default function (filter) { export default function (filter) {
return DiscourseRoute.extend({ return DiscourseRoute.extend({
actions: { @action
didTransition() { didTransition() {
this.controllerFor("user-posts")._showFooter(); this.controllerFor("user-posts")._showFooter();
return true; return true;
},
}, },
model() { model() {

View File

@ -1,6 +1,6 @@
import CategoryList from "discourse/models/category-list"; import CategoryList from "discourse/models/category-list";
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import EmberObject from "@ember/object"; import EmberObject, { action } from "@ember/object";
import I18n from "I18n"; import I18n from "I18n";
import OpenComposer from "discourse/mixins/open-composer"; import OpenComposer from "discourse/mixins/open-composer";
import PreloadStore from "discourse/lib/preload-store"; import PreloadStore from "discourse/lib/preload-store";
@ -130,31 +130,34 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
}); });
}, },
actions: { @action
triggerRefresh() { triggerRefresh() {
this.refresh(); this.refresh();
}, },
createCategory() { @action
this.transitionTo("newCategory"); createCategory() {
}, this.transitionTo("newCategory");
},
reorderCategories() { @action
showModal("reorderCategories"); reorderCategories() {
}, showModal("reorderCategories");
},
createTopic() { @action
if (this.get("currentUser.has_topic_draft")) { createTopic() {
this.openTopicDraft(); if (this.get("currentUser.has_topic_draft")) {
} else { this.openTopicDraft();
this.openComposer(this.controllerFor("discovery/categories")); } else {
} this.openComposer(this.controllerFor("discovery/categories"));
}, }
},
didTransition() { @action
next(() => this.controllerFor("application").set("showFooter", true)); didTransition() {
return true; next(() => this.controllerFor("application").set("showFooter", true));
}, return true;
}, },
}); });

View File

@ -8,6 +8,7 @@ import User from "discourse/models/user";
import { scrollTop } from "discourse/mixins/scroll-top"; import { scrollTop } from "discourse/mixins/scroll-top";
import { setTopicList } from "discourse/lib/topic-list-tracker"; import { setTopicList } from "discourse/lib/topic-list-tracker";
import Site from "discourse/models/site"; import Site from "discourse/models/site";
import { action } from "@ember/object";
export default DiscourseRoute.extend(OpenComposer, { export default DiscourseRoute.extend(OpenComposer, {
queryParams: { queryParams: {
@ -44,52 +45,57 @@ export default DiscourseRoute.extend(OpenComposer, {
} }
}, },
actions: { @action
loading() { loading() {
this.controllerFor("discovery").loadingBegan(); this.controllerFor("discovery").loadingBegan();
// We don't want loading to bubble // We don't want loading to bubble
return true; return true;
}, },
loadingComplete() { @action
this.controllerFor("discovery").loadingComplete(); loadingComplete() {
if (!this.session.get("topicListScrollPosition")) { this.controllerFor("discovery").loadingComplete();
scrollTop(); if (!this.session.get("topicListScrollPosition")) {
} scrollTop();
}, }
},
didTransition() { @action
this.send("loadingComplete"); didTransition() {
this.send("loadingComplete");
const model = this.controllerFor("discovery/topics").get("model"); const model = this.controllerFor("discovery/topics").get("model");
setTopicList(model); setTopicList(model);
}, },
// clear a pinned topic // clear a pinned topic
clearPin(topic) { @action
topic.clearPin(); clearPin(topic) {
}, topic.clearPin();
},
createTopic() { @action
if (this.get("currentUser.has_topic_draft")) { createTopic() {
this.openTopicDraft(); if (this.get("currentUser.has_topic_draft")) {
} else { this.openTopicDraft();
this.openComposer(this.controllerFor("discovery/topics")); } else {
} this.openComposer(this.controllerFor("discovery/topics"));
}, }
},
dismissReadTopics(dismissTopics) { @action
const operationType = dismissTopics ? "topics" : "posts"; dismissReadTopics(dismissTopics) {
this.send("dismissRead", operationType); const operationType = dismissTopics ? "topics" : "posts";
}, this.send("dismissRead", operationType);
},
dismissRead(operationType) { @action
const controller = this.controllerFor("discovery/topics"); dismissRead(operationType) {
controller.send("dismissRead", operationType, { const controller = this.controllerFor("discovery/topics");
categoryId: controller.get("category.id"), controller.send("dismissRead", operationType, {
includeSubcategories: !controller.noSubcategories, categoryId: controller.get("category.id"),
}); includeSubcategories: !controller.noSubcategories,
}, });
}, },
}); });

View File

@ -1,14 +1,14 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import { action } from "@ember/object";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
serialize() { serialize() {
return ""; return "";
}, },
actions: { @action
didTransition() { didTransition() {
this.controllerFor("application").set("showFooter", true); this.controllerFor("application").set("showFooter", true);
return true; return true;
},
}, },
}); });

View File

@ -9,6 +9,7 @@ import I18n from "I18n";
import PreloadStore from "discourse/lib/preload-store"; import PreloadStore from "discourse/lib/preload-store";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { escapeExpression } from "discourse/lib/utilities"; import { escapeExpression } from "discourse/lib/utilities";
import { action } from "@ember/object";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
queryParams: { queryParams: {
@ -64,10 +65,9 @@ export default DiscourseRoute.extend({
}); });
}, },
actions: { @action
didTransition() { didTransition() {
this.controllerFor("full-page-search")._showFooter(); this.controllerFor("full-page-search")._showFooter();
return true; return true;
},
}, },
}); });

View File

@ -1,6 +1,6 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import I18n from "I18n"; import I18n from "I18n";
import { get } from "@ember/object"; import { action, get } from "@ember/object";
export function buildGroupPage(type) { export function buildGroupPage(type) {
return DiscourseRoute.extend({ return DiscourseRoute.extend({
@ -29,10 +29,9 @@ export function buildGroupPage(type) {
this.render("group-activity-posts"); this.render("group-activity-posts");
}, },
actions: { @action
didTransition() { didTransition() {
return true; return true;
},
}, },
}); });
} }

View File

@ -1,5 +1,6 @@
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";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
titleToken() { titleToken() {
@ -14,9 +15,8 @@ export default DiscourseRoute.extend({
this.controllerFor("group-manage-logs").setProperties({ model }); this.controllerFor("group-manage-logs").setProperties({ model });
}, },
actions: { @action
willTransition() { willTransition() {
this.controllerFor("group-manage-logs").reset(); this.controllerFor("group-manage-logs").reset();
},
}, },
}); });

View File

@ -1,6 +1,7 @@
import RestrictedUserRoute from "discourse/routes/restricted-user"; import RestrictedUserRoute from "discourse/routes/restricted-user";
import UserBadge from "discourse/models/user-badge"; import UserBadge from "discourse/models/user-badge";
import showModal from "discourse/lib/show-modal"; import showModal from "discourse/lib/show-modal";
import { action } from "@ember/object";
export default RestrictedUserRoute.extend({ export default RestrictedUserRoute.extend({
showFooter: true, showFooter: true,
@ -33,9 +34,8 @@ export default RestrictedUserRoute.extend({
}); });
}, },
actions: { @action
showAvatarSelector(user) { showAvatarSelector(user) {
showModal("avatar-selector").setProperties({ user }); showModal("avatar-selector").setProperties({ user });
},
}, },
}); });

View File

@ -1,4 +1,5 @@
import RestrictedUserRoute from "discourse/routes/restricted-user"; import RestrictedUserRoute from "discourse/routes/restricted-user";
import { action } from "@ember/object";
export default RestrictedUserRoute.extend({ export default RestrictedUserRoute.extend({
showFooter: true, showFooter: true,
@ -34,27 +35,26 @@ export default RestrictedUserRoute.extend({
.finally(() => controller.set("loading", false)); .finally(() => controller.set("loading", false));
}, },
actions: { @action
willTransition(transition) { willTransition(transition) {
this._super(...arguments); this._super(...arguments);
const controller = this.controllerFor("preferences/second-factor"); const controller = this.controllerFor("preferences/second-factor");
const user = controller.get("currentUser"); const user = controller.get("currentUser");
const settings = controller.get("siteSettings"); const settings = controller.get("siteSettings");
if ( if (
transition.targetName === "preferences.second-factor" || transition.targetName === "preferences.second-factor" ||
!user || !user ||
user.is_anonymous || user.is_anonymous ||
user.second_factor_enabled || user.second_factor_enabled ||
(settings.enforce_second_factor === "staff" && !user.staff) || (settings.enforce_second_factor === "staff" && !user.staff) ||
settings.enforce_second_factor === "no" settings.enforce_second_factor === "no"
) { ) {
return true; return true;
} }
transition.abort(); transition.abort();
return false; return false;
},
}, },
}); });

View File

@ -1,5 +1,6 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import { isPresent } from "@ember/utils"; import { isPresent } from "@ember/utils";
import { action } from "@ember/object";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
model(params) { model(params) {
@ -74,9 +75,8 @@ export default DiscourseRoute.extend({
this.messageBus.unsubscribe("/reviewable_claimed"); this.messageBus.unsubscribe("/reviewable_claimed");
}, },
actions: { @action
refreshRoute() { refreshRoute() {
this.refresh(); this.refresh();
},
}, },
}); });

View File

@ -4,6 +4,7 @@ import Draft from "discourse/models/draft";
import { isEmpty } from "@ember/utils"; import { isEmpty } from "@ember/utils";
import { isTesting } from "discourse-common/config/environment"; import { isTesting } from "discourse-common/config/environment";
import { schedule } from "@ember/runloop"; import { schedule } from "@ember/runloop";
import { action } from "@ember/object";
// This route is used for retrieving a topic based on params // This route is used for retrieving a topic based on params
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
@ -114,16 +115,12 @@ export default DiscourseRoute.extend({
} }
}, },
actions: { @action
willTransition() { willTransition() {
this.controllerFor("topic").set( this.controllerFor("topic").set("previousURL", document.location.pathname);
"previousURL",
document.location.pathname
);
// NOTE: omitting this return can break the back button when transitioning quickly between // NOTE: omitting this return can break the back button when transitioning quickly between
// topics and the latest page. // topics and the latest page.
return true; return true;
},
}, },
}); });

View File

@ -2,7 +2,7 @@ import { cancel, later, schedule } from "@ember/runloop";
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import DiscourseURL from "discourse/lib/url"; import DiscourseURL from "discourse/lib/url";
import { ID_CONSTRAINT } from "discourse/models/topic"; import { ID_CONSTRAINT } from "discourse/models/topic";
import { get } from "@ember/object"; import { action, get } from "@ember/object";
import { isEmpty } from "@ember/utils"; import { isEmpty } from "@ember/utils";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import { setTopicId } from "discourse/lib/topic-list-tracker"; import { setTopicId } from "discourse/lib/topic-list-tracker";
@ -60,185 +60,197 @@ const TopicRoute = DiscourseRoute.extend({
} }
}, },
actions: { @action
showInvite() { showInvite() {
let invitePanelTitle; let invitePanelTitle;
if (this.isPM) { if (this.isPM) {
invitePanelTitle = "topic.invite_private.title"; invitePanelTitle = "topic.invite_private.title";
} else if (this.invitingToTopic) { } else if (this.invitingToTopic) {
invitePanelTitle = "topic.invite_reply.title"; invitePanelTitle = "topic.invite_reply.title";
} else { } else {
invitePanelTitle = "user.invited.create"; invitePanelTitle = "user.invited.create";
} }
showModal("share-and-invite", { showModal("share-and-invite", {
modalClass: "share-and-invite", modalClass: "share-and-invite",
panels: [ panels: [
{ {
id: "invite", id: "invite",
title: invitePanelTitle, title: invitePanelTitle,
model: { model: {
inviteModel: this.modelFor("topic"), inviteModel: this.modelFor("topic"),
},
}, },
], },
}); ],
}, });
},
showFlags(model) { @action
let controller = showModal("flag", { model }); showFlags(model) {
controller.setProperties({ flagTopic: false }); let controller = showModal("flag", { model });
}, controller.setProperties({ flagTopic: false });
},
showFlagTopic() { @action
const model = this.modelFor("topic"); showFlagTopic() {
let controller = showModal("flag", { model }); const model = this.modelFor("topic");
controller.setProperties({ flagTopic: true }); let controller = showModal("flag", { model });
}, controller.setProperties({ flagTopic: true });
},
showPagePublish() { @action
const model = this.modelFor("topic"); showPagePublish() {
showModal("publish-page", { const model = this.modelFor("topic");
model, showModal("publish-page", {
title: "topic.publish_page.title", model,
}); title: "topic.publish_page.title",
}, });
},
showTopicTimerModal() { @action
const model = this.modelFor("topic"); showTopicTimerModal() {
const model = this.modelFor("topic");
const topicTimer = model.get("topic_timer"); const topicTimer = model.get("topic_timer");
if (!topicTimer) { if (!topicTimer) {
model.set("topic_timer", {}); model.set("topic_timer", {});
}
showModal("edit-topic-timer", { model });
this.controllerFor("modal").set("modalClass", "edit-topic-timer-modal");
},
@action
showTopicSlowModeUpdate() {
const model = this.modelFor("topic");
showModal("edit-slow-mode", { model });
},
@action
showChangeTimestamp() {
showModal("change-timestamp", {
model: this.modelFor("topic"),
title: "topic.change_timestamp.title",
});
},
@action
showFeatureTopic() {
showModal("featureTopic", {
model: this.modelFor("topic"),
title: "topic.feature_topic.title",
});
this.controllerFor("modal").set("modalClass", "feature-topic-modal");
this.controllerFor("feature_topic").reset();
},
@action
showHistory(model, revision) {
let historyController = showModal("history", {
model,
modalClass: "history-modal",
});
historyController.refresh(model.get("id"), revision || "latest");
historyController.set("post", model);
historyController.set("topicController", this.controllerFor("topic"));
},
@action
showGrantBadgeModal() {
showModal("grant-badge", {
model: this.modelFor("topic"),
title: "admin.badges.grant_badge",
});
},
@action
showRawEmail(model) {
showModal("raw-email", { model });
this.controllerFor("raw_email").loadRawEmail(model.get("id"));
},
@action
moveToTopic() {
showModal("move-to-topic", {
model: this.modelFor("topic"),
title: "topic.move_to.title",
});
},
@action
changeOwner() {
showModal("change-owner", {
model: this.modelFor("topic"),
title: "topic.change_owner.title",
});
},
// Use replaceState to update the URL once it changes
@action
postChangedRoute(currentPost) {
// do nothing if we are transitioning to another route
if (this.isTransitioning || TopicRoute.disableReplaceState) {
return;
}
const topic = this.modelFor("topic");
if (topic && currentPost) {
let postUrl;
if (currentPost > 1) {
postUrl = topic.urlForPostNumber(currentPost);
} else {
postUrl = topic.url;
} }
showModal("edit-topic-timer", { model }); if (this._router.currentRoute.queryParams) {
this.controllerFor("modal").set("modalClass", "edit-topic-timer-modal"); let searchParams;
},
showTopicSlowModeUpdate() { Object.entries(this._router.currentRoute.queryParams).map(
const model = this.modelFor("topic"); ([key, value]) => {
if (!searchParams) {
showModal("edit-slow-mode", { model }); searchParams = new URLSearchParams();
},
showChangeTimestamp() {
showModal("change-timestamp", {
model: this.modelFor("topic"),
title: "topic.change_timestamp.title",
});
},
showFeatureTopic() {
showModal("featureTopic", {
model: this.modelFor("topic"),
title: "topic.feature_topic.title",
});
this.controllerFor("modal").set("modalClass", "feature-topic-modal");
this.controllerFor("feature_topic").reset();
},
showHistory(model, revision) {
let historyController = showModal("history", {
model,
modalClass: "history-modal",
});
historyController.refresh(model.get("id"), revision || "latest");
historyController.set("post", model);
historyController.set("topicController", this.controllerFor("topic"));
},
showGrantBadgeModal() {
showModal("grant-badge", {
model: this.modelFor("topic"),
title: "admin.badges.grant_badge",
});
},
showRawEmail(model) {
showModal("raw-email", { model });
this.controllerFor("raw_email").loadRawEmail(model.get("id"));
},
moveToTopic() {
showModal("move-to-topic", {
model: this.modelFor("topic"),
title: "topic.move_to.title",
});
},
changeOwner() {
showModal("change-owner", {
model: this.modelFor("topic"),
title: "topic.change_owner.title",
});
},
// Use replaceState to update the URL once it changes
postChangedRoute(currentPost) {
// do nothing if we are transitioning to another route
if (this.isTransitioning || TopicRoute.disableReplaceState) {
return;
}
const topic = this.modelFor("topic");
if (topic && currentPost) {
let postUrl;
if (currentPost > 1) {
postUrl = topic.urlForPostNumber(currentPost);
} else {
postUrl = topic.url;
}
if (this._router.currentRoute.queryParams) {
let searchParams;
Object.entries(this._router.currentRoute.queryParams).map(
([key, value]) => {
if (!searchParams) {
searchParams = new URLSearchParams();
}
searchParams.append(key, value);
} }
);
if (searchParams) { searchParams.append(key, value);
postUrl += `?${searchParams.toString()}`;
} }
);
if (searchParams) {
postUrl += `?${searchParams.toString()}`;
} }
cancel(this.scheduledReplace);
this.setProperties({
lastScrollPos: parseInt($(document).scrollTop(), 10),
scheduledReplace: later(
this,
"_replaceUnlessScrolling",
postUrl,
Ember.Test ? 0 : SCROLL_DELAY
),
});
} }
},
didTransition() {
const controller = this.controllerFor("topic");
controller._showFooter();
const topicId = controller.get("model.id");
setTopicId(topicId);
return true;
},
willTransition() {
this._super(...arguments);
cancel(this.scheduledReplace); cancel(this.scheduledReplace);
this.set("isTransitioning", true);
return true; this.setProperties({
}, lastScrollPos: parseInt($(document).scrollTop(), 10),
scheduledReplace: later(
this,
"_replaceUnlessScrolling",
postUrl,
Ember.Test ? 0 : SCROLL_DELAY
),
});
}
},
@action
didTransition() {
const controller = this.controllerFor("topic");
controller._showFooter();
const topicId = controller.get("model.id");
setTopicId(topicId);
return true;
},
@action
willTransition() {
this._super(...arguments);
cancel(this.scheduledReplace);
this.set("isTransitioning", true);
return true;
}, },
// replaceState can be very slow on Android Chrome. This function debounces replaceState // replaceState can be very slow on Android Chrome. This function debounces replaceState

View File

@ -1,5 +1,6 @@
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";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
model() { model() {
@ -38,10 +39,9 @@ export default DiscourseRoute.extend({
this.appEvents.off("draft:destroyed", this, this.refresh); this.appEvents.off("draft:destroyed", this, this.refresh);
}, },
actions: { @action
didTransition() { didTransition() {
this.controllerFor("user-activity")._showFooter(); this.controllerFor("user-activity")._showFooter();
return true; return true;
},
}, },
}); });

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import UserBadge from "discourse/models/user-badge"; import UserBadge from "discourse/models/user-badge";
import ViewingActionType from "discourse/mixins/viewing-action-type"; import ViewingActionType from "discourse/mixins/viewing-action-type";
import { action } from "@ember/object";
export default DiscourseRoute.extend(ViewingActionType, { export default DiscourseRoute.extend(ViewingActionType, {
model() { model() {
@ -19,10 +20,9 @@ export default DiscourseRoute.extend(ViewingActionType, {
this.render("user/badges", { into: "user" }); this.render("user/badges", { into: "user" });
}, },
actions: { @action
didTransition() { didTransition() {
this.controllerFor("application").set("showFooter", true); this.controllerFor("application").set("showFooter", true);
return true; return true;
},
}, },
}); });

View File

@ -1,5 +1,6 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import Invite from "discourse/models/invite"; import Invite from "discourse/models/invite";
import { action } from "@ember/object";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
model(params) { model(params) {
@ -26,9 +27,8 @@ export default DiscourseRoute.extend({
}); });
}, },
actions: { @action
triggerRefresh() { triggerRefresh() {
this.refresh(); this.refresh();
},
}, },
}); });

View File

@ -1,5 +1,6 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import ViewingActionType from "discourse/mixins/viewing-action-type"; import ViewingActionType from "discourse/mixins/viewing-action-type";
import { action } from "@ember/object";
export default DiscourseRoute.extend(ViewingActionType, { export default DiscourseRoute.extend(ViewingActionType, {
controllerName: "user-notifications", controllerName: "user-notifications",
@ -9,11 +10,10 @@ export default DiscourseRoute.extend(ViewingActionType, {
this.render("user/notifications"); this.render("user/notifications");
}, },
actions: { @action
didTransition() { didTransition() {
this.controllerFor("user-notifications")._showFooter(); this.controllerFor("user-notifications")._showFooter();
return true; return true;
},
}, },
model(params) { model(params) {

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
import I18n from "I18n"; import I18n from "I18n";
import User from "discourse/models/user"; import User from "discourse/models/user";
import { action } from "@ember/object";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
titleToken() { titleToken() {
@ -10,14 +11,14 @@ export default DiscourseRoute.extend({
} }
}, },
actions: { @action
undoRevokeApiKey(key) { undoRevokeApiKey(key) {
key.undoRevoke(); key.undoRevoke();
}, },
revokeApiKey(key) { @action
key.revoke(); revokeApiKey(key) {
}, key.revoke();
}, },
beforeModel() { beforeModel() {

View File

@ -3,6 +3,7 @@ import I18n from "I18n";
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 { Promise } from "rsvp"; import { Promise } from "rsvp";
import { action } from "@ember/object";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
queryParams: { queryParams: {
@ -55,10 +56,9 @@ export default DiscourseRoute.extend({
]); ]);
}, },
actions: { @action
didTransition() { didTransition() {
this.controllerFor("users")._showFooter(); this.controllerFor("users")._showFooter();
return true; return true;
},
}, },
}); });