diff --git a/app/assets/javascripts/discourse/app/routes/build-admin-user-posts-route.js b/app/assets/javascripts/discourse/app/routes/build-admin-user-posts-route.js index ab2756565bb..fbbc3fd6f48 100644 --- a/app/assets/javascripts/discourse/app/routes/build-admin-user-posts-route.js +++ b/app/assets/javascripts/discourse/app/routes/build-admin-user-posts-route.js @@ -5,11 +5,7 @@ import { action } from "@ember/object"; export default function (filter) { return DiscourseRoute.extend({ - @action - didTransition() { - this.controllerFor("user-posts")._showFooter(); - return true; - }, + templateName: "user/posts", model() { return this.modelFor("user").get("postsStream"); @@ -32,8 +28,10 @@ export default function (filter) { this.controllerFor("user-posts").set("model", model); }, - renderTemplate() { - this.render("user/posts"); + @action + didTransition() { + this.controllerFor("user-posts")._showFooter(); + return true; }, }); } diff --git a/app/assets/javascripts/discourse/app/routes/exception-unknown.js b/app/assets/javascripts/discourse/app/routes/exception-unknown.js index e1001b47cbc..d223a1aab25 100644 --- a/app/assets/javascripts/discourse/app/routes/exception-unknown.js +++ b/app/assets/javascripts/discourse/app/routes/exception-unknown.js @@ -1,7 +1,5 @@ import UnknownRoute from "discourse/routes/unknown"; export default UnknownRoute.extend({ - renderTemplate() { - this.render("unknown"); - }, + templateName: "unknown", }); diff --git a/app/assets/javascripts/discourse/app/routes/group-activity-posts.js b/app/assets/javascripts/discourse/app/routes/group-activity-posts.js index dddbc26f876..925368a0658 100644 --- a/app/assets/javascripts/discourse/app/routes/group-activity-posts.js +++ b/app/assets/javascripts/discourse/app/routes/group-activity-posts.js @@ -5,6 +5,8 @@ import { action, get } from "@ember/object"; export function buildGroupPage(type) { return DiscourseRoute.extend({ type, + templateName: "group-activity-posts", + controllerName: "group-activity-posts", titleToken() { return I18n.t(`groups.${type}`); @@ -17,7 +19,7 @@ export function buildGroupPage(type) { setupController(controller, model) { let loadedAll = model.length < 20; - this.controllerFor("group-activity-posts").setProperties({ + controller.setProperties({ model, type, canLoadMore: !loadedAll, @@ -25,10 +27,6 @@ export function buildGroupPage(type) { this.controllerFor("application").set("showFooter", loadedAll); }, - renderTemplate() { - this.render("group-activity-posts"); - }, - @action didTransition() { return true; diff --git a/app/assets/javascripts/discourse/app/routes/user-activity-bookmarks.js b/app/assets/javascripts/discourse/app/routes/user-activity-bookmarks.js index af88f4f95c1..fcbea962c38 100644 --- a/app/assets/javascripts/discourse/app/routes/user-activity-bookmarks.js +++ b/app/assets/javascripts/discourse/app/routes/user-activity-bookmarks.js @@ -5,6 +5,8 @@ import { Promise } from "rsvp"; import I18n from "I18n"; export default DiscourseRoute.extend({ + templateName: "user/bookmarks", + queryParams: { acting_username: { refreshModel: true }, q: { refreshModel: true }, @@ -47,10 +49,6 @@ export default DiscourseRoute.extend({ .finally(() => controller.set("loading", false)); }, - renderTemplate() { - this.render("user_bookmarks"); - }, - titleToken() { return I18n.t("user_action_groups.3"); }, diff --git a/app/assets/javascripts/discourse/app/routes/user-activity-drafts.js b/app/assets/javascripts/discourse/app/routes/user-activity-drafts.js index c73975624e8..c3ec009a7e7 100644 --- a/app/assets/javascripts/discourse/app/routes/user-activity-drafts.js +++ b/app/assets/javascripts/discourse/app/routes/user-activity-drafts.js @@ -3,6 +3,8 @@ import I18n from "I18n"; import { action } from "@ember/object"; export default DiscourseRoute.extend({ + templateName: "user/stream", + model() { const user = this.modelFor("user"); const draftsStream = user.get("userDraftsStream"); @@ -16,14 +18,6 @@ export default DiscourseRoute.extend({ }); }, - renderTemplate() { - this.render("user_stream"); - }, - - setupController(controller, model) { - controller.set("model", model); - }, - emptyState() { const title = I18n.t("user_activity.no_drafts_title"); const body = I18n.t("user_activity.no_drafts_body"); diff --git a/app/assets/javascripts/discourse/app/routes/user-activity-stream.js b/app/assets/javascripts/discourse/app/routes/user-activity-stream.js index 8195788a337..87776a2d21f 100644 --- a/app/assets/javascripts/discourse/app/routes/user-activity-stream.js +++ b/app/assets/javascripts/discourse/app/routes/user-activity-stream.js @@ -4,6 +4,8 @@ import { action } from "@ember/object"; import I18n from "I18n"; export default DiscourseRoute.extend(ViewingActionType, { + templateName: "user/stream", + queryParams: { acting_username: { refreshModel: true }, }, @@ -29,12 +31,8 @@ export default DiscourseRoute.extend(ViewingActionType, { }); }, - renderTemplate() { - this.render("user_stream"); - }, - - setupController(controller, model) { - controller.set("model", model); + setupController() { + this._super(...arguments); this.viewingActionType(this.userActionType); }, diff --git a/app/assets/javascripts/discourse/app/routes/user-badges.js b/app/assets/javascripts/discourse/app/routes/user-badges.js index e604e7ccb30..852bf7fa459 100644 --- a/app/assets/javascripts/discourse/app/routes/user-badges.js +++ b/app/assets/javascripts/discourse/app/routes/user-badges.js @@ -5,6 +5,8 @@ import { action } from "@ember/object"; import I18n from "I18n"; export default DiscourseRoute.extend(ViewingActionType, { + templateName: "user/badges", + model() { return UserBadge.findByUsername( this.modelFor("user").get("username_lower"), @@ -12,13 +14,9 @@ export default DiscourseRoute.extend(ViewingActionType, { ); }, - setupController(controller, model) { + setupController() { + this._super(...arguments); this.viewingActionType(-1); - controller.set("model", model); - }, - - renderTemplate() { - this.render("user/badges"); }, titleToken() { diff --git a/app/assets/javascripts/discourse/app/routes/user-notifications-index.js b/app/assets/javascripts/discourse/app/routes/user-notifications-index.js index 99709d47de6..04a2d01da1b 100644 --- a/app/assets/javascripts/discourse/app/routes/user-notifications-index.js +++ b/app/assets/javascripts/discourse/app/routes/user-notifications-index.js @@ -3,9 +3,7 @@ import I18n from "I18n"; export default DiscourseRoute.extend({ controllerName: "user-notifications", - renderTemplate() { - this.render("user/notifications-index"); - }, + templateName: "user/notifications-index", titleToken() { return I18n.t("user.filters.all"); diff --git a/app/assets/javascripts/discourse/app/routes/user-notifications.js b/app/assets/javascripts/discourse/app/routes/user-notifications.js index aa93fa7a8a7..d7a02592bf7 100644 --- a/app/assets/javascripts/discourse/app/routes/user-notifications.js +++ b/app/assets/javascripts/discourse/app/routes/user-notifications.js @@ -27,8 +27,8 @@ export default DiscourseRoute.extend(ViewingActionType, { } }, - setupController(controller, model) { - controller.set("model", model); + setupController(controller) { + this._super(...arguments); controller.set("user", this.modelFor("user")); this.viewingActionType(-1); }, diff --git a/app/assets/javascripts/discourse/app/routes/user-private-messages.js b/app/assets/javascripts/discourse/app/routes/user-private-messages.js index 5e631ce9ac8..23d9c01b605 100644 --- a/app/assets/javascripts/discourse/app/routes/user-private-messages.js +++ b/app/assets/javascripts/discourse/app/routes/user-private-messages.js @@ -5,12 +5,9 @@ import { action } from "@ember/object"; import { inject as service } from "@ember/service"; export default DiscourseRoute.extend({ + templateName: "user/messages", composer: service(), - renderTemplate() { - this.render("user/messages"); - }, - model() { return this.modelFor("user"); }, @@ -19,8 +16,8 @@ export default DiscourseRoute.extend({ return this.pmTopicTrackingState.startTracking(); }, - setupController(controller, model) { - controller.set("model", model); + setupController() { + this._super(...arguments); if (this.currentUser) { Draft.get("new_private_message").then((data) => { diff --git a/app/assets/javascripts/discourse/app/routes/user-topic-list.js b/app/assets/javascripts/discourse/app/routes/user-topic-list.js index 3f48e195ef7..a1c91aab225 100644 --- a/app/assets/javascripts/discourse/app/routes/user-topic-list.js +++ b/app/assets/javascripts/discourse/app/routes/user-topic-list.js @@ -3,9 +3,8 @@ import ViewingActionType from "discourse/mixins/viewing-action-type"; import { setTopicList } from "discourse/lib/topic-list-tracker"; export default DiscourseRoute.extend(ViewingActionType, { - renderTemplate() { - this.render("user-topics-list"); - }, + templateName: "user-topics-list", + controllerName: "user-topics-list", setupController(controller, model) { setTopicList(model); @@ -13,7 +12,7 @@ export default DiscourseRoute.extend(ViewingActionType, { const userActionType = this.userActionType; this.controllerFor("user").set("userActionType", userActionType); this.controllerFor("user-activity").set("userActionType", userActionType); - this.controllerFor("user-topics-list").setProperties({ + controller.setProperties({ model, hideCategory: false, });