mirror of
https://github.com/discourse/discourse.git
synced 2025-06-09 17:28:13 +08:00
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:

committed by
GitHub

parent
88f9bb3dc9
commit
284ab8cdf7
@ -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;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
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() {
|
||||||
return this.modelFor("user").get("postsStream");
|
return this.modelFor("user").get("postsStream");
|
||||||
|
@ -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,19 +130,22 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
triggerRefresh() {
|
triggerRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
createCategory() {
|
createCategory() {
|
||||||
this.transitionTo("newCategory");
|
this.transitionTo("newCategory");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
reorderCategories() {
|
reorderCategories() {
|
||||||
showModal("reorderCategories");
|
showModal("reorderCategories");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
createTopic() {
|
createTopic() {
|
||||||
if (this.get("currentUser.has_topic_draft")) {
|
if (this.get("currentUser.has_topic_draft")) {
|
||||||
this.openTopicDraft();
|
this.openTopicDraft();
|
||||||
@ -151,11 +154,11 @@ const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
didTransition() {
|
didTransition() {
|
||||||
next(() => this.controllerFor("application").set("showFooter", true));
|
next(() => this.controllerFor("application").set("showFooter", true));
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default DiscoveryCategoriesRoute;
|
export default DiscoveryCategoriesRoute;
|
||||||
|
@ -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,7 +45,7 @@ export default DiscourseRoute.extend(OpenComposer, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
loading() {
|
loading() {
|
||||||
this.controllerFor("discovery").loadingBegan();
|
this.controllerFor("discovery").loadingBegan();
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ export default DiscourseRoute.extend(OpenComposer, {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
loadingComplete() {
|
loadingComplete() {
|
||||||
this.controllerFor("discovery").loadingComplete();
|
this.controllerFor("discovery").loadingComplete();
|
||||||
if (!this.session.get("topicListScrollPosition")) {
|
if (!this.session.get("topicListScrollPosition")) {
|
||||||
@ -59,6 +61,7 @@ export default DiscourseRoute.extend(OpenComposer, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
didTransition() {
|
didTransition() {
|
||||||
this.send("loadingComplete");
|
this.send("loadingComplete");
|
||||||
|
|
||||||
@ -67,10 +70,12 @@ export default DiscourseRoute.extend(OpenComposer, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// clear a pinned topic
|
// clear a pinned topic
|
||||||
|
@action
|
||||||
clearPin(topic) {
|
clearPin(topic) {
|
||||||
topic.clearPin();
|
topic.clearPin();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
createTopic() {
|
createTopic() {
|
||||||
if (this.get("currentUser.has_topic_draft")) {
|
if (this.get("currentUser.has_topic_draft")) {
|
||||||
this.openTopicDraft();
|
this.openTopicDraft();
|
||||||
@ -79,11 +84,13 @@ export default DiscourseRoute.extend(OpenComposer, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
dismissReadTopics(dismissTopics) {
|
dismissReadTopics(dismissTopics) {
|
||||||
const operationType = dismissTopics ? "topics" : "posts";
|
const operationType = dismissTopics ? "topics" : "posts";
|
||||||
this.send("dismissRead", operationType);
|
this.send("dismissRead", operationType);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
dismissRead(operationType) {
|
dismissRead(operationType) {
|
||||||
const controller = this.controllerFor("discovery/topics");
|
const controller = this.controllerFor("discovery/topics");
|
||||||
controller.send("dismissRead", operationType, {
|
controller.send("dismissRead", operationType, {
|
||||||
@ -91,5 +98,4 @@ export default DiscourseRoute.extend(OpenComposer, {
|
|||||||
includeSubcategories: !controller.noSubcategories,
|
includeSubcategories: !controller.noSubcategories,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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,11 +29,10 @@ export function buildGroupPage(type) {
|
|||||||
this.render("group-activity-posts");
|
this.render("group-activity-posts");
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
didTransition() {
|
didTransition() {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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 });
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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,7 +35,7 @@ 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);
|
||||||
|
|
||||||
@ -56,5 +57,4 @@ export default RestrictedUserRoute.extend({
|
|||||||
transition.abort();
|
transition.abort();
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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();
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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,7 +60,7 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
showInvite() {
|
showInvite() {
|
||||||
let invitePanelTitle;
|
let invitePanelTitle;
|
||||||
|
|
||||||
@ -86,17 +86,20 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showFlags(model) {
|
showFlags(model) {
|
||||||
let controller = showModal("flag", { model });
|
let controller = showModal("flag", { model });
|
||||||
controller.setProperties({ flagTopic: false });
|
controller.setProperties({ flagTopic: false });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showFlagTopic() {
|
showFlagTopic() {
|
||||||
const model = this.modelFor("topic");
|
const model = this.modelFor("topic");
|
||||||
let controller = showModal("flag", { model });
|
let controller = showModal("flag", { model });
|
||||||
controller.setProperties({ flagTopic: true });
|
controller.setProperties({ flagTopic: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showPagePublish() {
|
showPagePublish() {
|
||||||
const model = this.modelFor("topic");
|
const model = this.modelFor("topic");
|
||||||
showModal("publish-page", {
|
showModal("publish-page", {
|
||||||
@ -105,6 +108,7 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showTopicTimerModal() {
|
showTopicTimerModal() {
|
||||||
const model = this.modelFor("topic");
|
const model = this.modelFor("topic");
|
||||||
|
|
||||||
@ -117,12 +121,14 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
this.controllerFor("modal").set("modalClass", "edit-topic-timer-modal");
|
this.controllerFor("modal").set("modalClass", "edit-topic-timer-modal");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showTopicSlowModeUpdate() {
|
showTopicSlowModeUpdate() {
|
||||||
const model = this.modelFor("topic");
|
const model = this.modelFor("topic");
|
||||||
|
|
||||||
showModal("edit-slow-mode", { model });
|
showModal("edit-slow-mode", { model });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showChangeTimestamp() {
|
showChangeTimestamp() {
|
||||||
showModal("change-timestamp", {
|
showModal("change-timestamp", {
|
||||||
model: this.modelFor("topic"),
|
model: this.modelFor("topic"),
|
||||||
@ -130,6 +136,7 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showFeatureTopic() {
|
showFeatureTopic() {
|
||||||
showModal("featureTopic", {
|
showModal("featureTopic", {
|
||||||
model: this.modelFor("topic"),
|
model: this.modelFor("topic"),
|
||||||
@ -139,6 +146,7 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
this.controllerFor("feature_topic").reset();
|
this.controllerFor("feature_topic").reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showHistory(model, revision) {
|
showHistory(model, revision) {
|
||||||
let historyController = showModal("history", {
|
let historyController = showModal("history", {
|
||||||
model,
|
model,
|
||||||
@ -149,6 +157,7 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
historyController.set("topicController", this.controllerFor("topic"));
|
historyController.set("topicController", this.controllerFor("topic"));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showGrantBadgeModal() {
|
showGrantBadgeModal() {
|
||||||
showModal("grant-badge", {
|
showModal("grant-badge", {
|
||||||
model: this.modelFor("topic"),
|
model: this.modelFor("topic"),
|
||||||
@ -156,11 +165,13 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
showRawEmail(model) {
|
showRawEmail(model) {
|
||||||
showModal("raw-email", { model });
|
showModal("raw-email", { model });
|
||||||
this.controllerFor("raw_email").loadRawEmail(model.get("id"));
|
this.controllerFor("raw_email").loadRawEmail(model.get("id"));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
moveToTopic() {
|
moveToTopic() {
|
||||||
showModal("move-to-topic", {
|
showModal("move-to-topic", {
|
||||||
model: this.modelFor("topic"),
|
model: this.modelFor("topic"),
|
||||||
@ -168,6 +179,7 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
changeOwner() {
|
changeOwner() {
|
||||||
showModal("change-owner", {
|
showModal("change-owner", {
|
||||||
model: this.modelFor("topic"),
|
model: this.modelFor("topic"),
|
||||||
@ -176,6 +188,7 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Use replaceState to update the URL once it changes
|
// Use replaceState to update the URL once it changes
|
||||||
|
@action
|
||||||
postChangedRoute(currentPost) {
|
postChangedRoute(currentPost) {
|
||||||
// do nothing if we are transitioning to another route
|
// do nothing if we are transitioning to another route
|
||||||
if (this.isTransitioning || TopicRoute.disableReplaceState) {
|
if (this.isTransitioning || TopicRoute.disableReplaceState) {
|
||||||
@ -183,10 +196,8 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const topic = this.modelFor("topic");
|
const topic = this.modelFor("topic");
|
||||||
|
|
||||||
if (topic && currentPost) {
|
if (topic && currentPost) {
|
||||||
let postUrl;
|
let postUrl;
|
||||||
|
|
||||||
if (currentPost > 1) {
|
if (currentPost > 1) {
|
||||||
postUrl = topic.urlForPostNumber(currentPost);
|
postUrl = topic.urlForPostNumber(currentPost);
|
||||||
} else {
|
} else {
|
||||||
@ -225,6 +236,7 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
didTransition() {
|
didTransition() {
|
||||||
const controller = this.controllerFor("topic");
|
const controller = this.controllerFor("topic");
|
||||||
controller._showFooter();
|
controller._showFooter();
|
||||||
@ -233,13 +245,13 @@ const TopicRoute = DiscourseRoute.extend({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
willTransition() {
|
willTransition() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
cancel(this.scheduledReplace);
|
cancel(this.scheduledReplace);
|
||||||
this.set("isTransitioning", true);
|
this.set("isTransitioning", true);
|
||||||
return 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
|
||||||
// within a topic until scrolling stops
|
// within a topic until scrolling stops
|
||||||
|
@ -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;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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();
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -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,12 +10,11 @@ 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) {
|
||||||
const username = this.modelFor("user").get("username");
|
const username = this.modelFor("user").get("username");
|
||||||
|
@ -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,15 +11,15 @@ export default DiscourseRoute.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
@action
|
||||||
undoRevokeApiKey(key) {
|
undoRevokeApiKey(key) {
|
||||||
key.undoRevoke();
|
key.undoRevoke();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@action
|
||||||
revokeApiKey(key) {
|
revokeApiKey(key) {
|
||||||
key.revoke();
|
key.revoke();
|
||||||
},
|
},
|
||||||
},
|
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (this.siteSettings.hide_user_profiles_from_public && !this.currentUser) {
|
if (this.siteSettings.hide_user_profiles_from_public && !this.currentUser) {
|
||||||
|
@ -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;
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user