DEV: Use `templateName` instead of `renderTemplate()` (#21517)

`renderTemplate()` is deprecated and has been removed in Ember 4.0
This commit is contained in:
Jarek Radosz 2023-05-19 11:14:38 +02:00 committed by GitHub
parent db9d998de3
commit 48987af324
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 30 additions and 54 deletions

View File

@ -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;
},
});
}

View File

@ -1,7 +1,5 @@
import UnknownRoute from "discourse/routes/unknown";
export default UnknownRoute.extend({
renderTemplate() {
this.render("unknown");
},
templateName: "unknown",
});

View File

@ -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;

View File

@ -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");
},

View File

@ -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");

View File

@ -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);
},

View File

@ -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() {

View File

@ -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");

View File

@ -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);
},

View File

@ -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) => {

View File

@ -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,
});