DEV: migrate more routes away from the old `actions:` pattern (#15275)
This commit is contained in:
parent
a09b6fe114
commit
6afab87d50
|
@ -14,6 +14,7 @@ import DiscourseRoute from "discourse/routes/discourse";
|
|||
import I18n from "I18n";
|
||||
import PermissionType from "discourse/models/permission-type";
|
||||
import TopicList from "discourse/models/topic-list";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
// A helper function to create a category route with parameters
|
||||
export default (filterArg, params) => {
|
||||
|
@ -208,17 +209,24 @@ export default (filterArg, params) => {
|
|||
this.searchService.set("searchContext", null);
|
||||
},
|
||||
|
||||
actions: {
|
||||
@action
|
||||
setNotification(notification_level) {
|
||||
this.currentModel.setNotification(notification_level);
|
||||
},
|
||||
|
||||
@action
|
||||
triggerRefresh() {
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
changeSort,
|
||||
resetParams,
|
||||
@action
|
||||
changeSort(sortBy) {
|
||||
changeSort.call(this, sortBy);
|
||||
},
|
||||
|
||||
@action
|
||||
resetParams(skipParams = []) {
|
||||
resetParams.call(this, skipParams);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -12,6 +12,7 @@ import { deepEqual } from "discourse-common/lib/object";
|
|||
import { defaultHomepage } from "discourse/lib/utilities";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
// A helper to build a topic route for a filter
|
||||
function filterQueryParams(params, defaultParams) {
|
||||
|
@ -151,9 +152,14 @@ export default function (filter, extras) {
|
|||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
changeSort,
|
||||
resetParams,
|
||||
@action
|
||||
changeSort(sortBy) {
|
||||
changeSort.call(this, sortBy);
|
||||
},
|
||||
|
||||
@action
|
||||
resetParams(skipParams = []) {
|
||||
resetParams.call(this, skipParams);
|
||||
},
|
||||
},
|
||||
extras
|
||||
|
|
|
@ -16,6 +16,7 @@ import { escapeExpression } from "discourse/lib/utilities";
|
|||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { setTopicList } from "discourse/lib/topic-list-tracker";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default DiscourseRoute.extend(FilterModeMixin, {
|
||||
navMode: "latest",
|
||||
|
@ -170,11 +171,12 @@ export default DiscourseRoute.extend(FilterModeMixin, {
|
|||
this.searchService.set("searchContext", null);
|
||||
},
|
||||
|
||||
actions: {
|
||||
@action
|
||||
renameTag(tag) {
|
||||
showModal("rename-tag", { model: tag });
|
||||
},
|
||||
|
||||
@action
|
||||
createTopic() {
|
||||
if (this.get("currentUser.has_topic_draft")) {
|
||||
this.openTopicDraft();
|
||||
|
@ -203,11 +205,13 @@ export default DiscourseRoute.extend(FilterModeMixin, {
|
|||
}
|
||||
},
|
||||
|
||||
@action
|
||||
dismissReadTopics(dismissTopics) {
|
||||
const operationType = dismissTopics ? "topics" : "posts";
|
||||
this.send("dismissRead", operationType);
|
||||
},
|
||||
|
||||
@action
|
||||
dismissRead(operationType) {
|
||||
const controller = this.controllerFor("tags-show");
|
||||
let options = {
|
||||
|
@ -225,11 +229,14 @@ export default DiscourseRoute.extend(FilterModeMixin, {
|
|||
controller.send("dismissRead", operationType, options);
|
||||
},
|
||||
|
||||
resetParams,
|
||||
@action
|
||||
resetParams(skipParams = []) {
|
||||
resetParams.call(this, skipParams);
|
||||
},
|
||||
|
||||
@action
|
||||
didTransition() {
|
||||
this.controllerFor("tag.show")._showFooter();
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue