mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 12:13:58 -06:00
DEV: Remove renderTemplate from 2fa preferences, email preferences, and new-category (#22156)
This commit is contained in:
parent
37030ed348
commit
9984accfa5
@ -423,6 +423,12 @@ const User = RestModel.extend({
|
|||||||
return ajax(userPath(`${this.username_lower}/preferences/email`), {
|
return ajax(userPath(`${this.username_lower}/preferences/email`), {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
data: { email },
|
data: { email },
|
||||||
|
}).then(() => {
|
||||||
|
if (!this.unconfirmed_emails) {
|
||||||
|
this.set("unconfirmed_emails", []);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.unconfirmed_emails.pushObject(email);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -430,6 +436,12 @@ const User = RestModel.extend({
|
|||||||
return ajax(userPath(`${this.username_lower}/preferences/email`), {
|
return ajax(userPath(`${this.username_lower}/preferences/email`), {
|
||||||
type: "PUT",
|
type: "PUT",
|
||||||
data: { email },
|
data: { email },
|
||||||
|
}).then(() => {
|
||||||
|
if (!this.unconfirmed_emails) {
|
||||||
|
this.set("unconfirmed_emails", []);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.unconfirmed_emails.pushObject(email);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -179,7 +179,6 @@ export default function () {
|
|||||||
|
|
||||||
this.route("email");
|
this.route("email");
|
||||||
this.route("second-factor");
|
this.route("second-factor");
|
||||||
this.route("second-factor-backup");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route(
|
this.route(
|
||||||
|
@ -3,8 +3,8 @@ import I18n from "I18n";
|
|||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
import { SEARCH_PRIORITIES } from "discourse/lib/constants";
|
import { SEARCH_PRIORITIES } from "discourse/lib/constants";
|
||||||
|
|
||||||
let _newCategoryColor = "0088CC",
|
let _newCategoryColor = "0088CC";
|
||||||
_newCategoryTextColor = "FFFFFF";
|
let _newCategoryTextColor = "FFFFFF";
|
||||||
|
|
||||||
export function setNewCategoryDefaultColors(backgroundColor, textColor) {
|
export function setNewCategoryDefaultColors(backgroundColor, textColor) {
|
||||||
_newCategoryColor = backgroundColor;
|
_newCategoryColor = backgroundColor;
|
||||||
@ -12,6 +12,9 @@ export function setNewCategoryDefaultColors(backgroundColor, textColor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
|
controllerName: "edit-category-tabs",
|
||||||
|
templateName: "edit-category-tabs",
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (!this.currentUser) {
|
if (!this.currentUser) {
|
||||||
this.replaceWith("/404");
|
this.replaceWith("/404");
|
||||||
@ -71,11 +74,4 @@ export default DiscourseRoute.extend({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate() {
|
|
||||||
this.render("edit-category-tabs", {
|
|
||||||
controller: "edit-category-tabs",
|
|
||||||
model: this.currentModel,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -7,16 +7,12 @@ export default RestrictedUserRoute.extend({
|
|||||||
return this.modelFor("user");
|
return this.modelFor("user");
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate() {
|
|
||||||
this.render({ into: "user" });
|
|
||||||
},
|
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.reset();
|
controller.reset();
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
model,
|
model,
|
||||||
oldEmail: controller.new ? "" : model.get("email"),
|
oldEmail: controller.new ? "" : model.email,
|
||||||
newEmail: controller.new ? "" : model.get("email"),
|
newEmail: controller.new ? "" : model.email,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -25,10 +21,4 @@ export default RestrictedUserRoute.extend({
|
|||||||
controller.set("new", undefined);
|
controller.set("new", undefined);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// A bit odd, but if we leave to /preferences we need to re-render that outlet
|
|
||||||
deactivate() {
|
|
||||||
this._super(...arguments);
|
|
||||||
this.render("preferences", { into: "user", controller: "preferences" });
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default RestrictedUserRoute.extend({
|
||||||
|
currentUser: service(),
|
||||||
|
siteSettings: service(),
|
||||||
|
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor("user");
|
return this.modelFor("user");
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate() {
|
|
||||||
return this.render({ into: "user" });
|
|
||||||
},
|
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.setProperties({ model, newUsername: model.get("username") });
|
controller.setProperties({ model, newUsername: model.username });
|
||||||
controller.set("loading", true);
|
controller.set("loading", true);
|
||||||
|
|
||||||
model
|
model
|
||||||
@ -39,17 +39,14 @@ export default RestrictedUserRoute.extend({
|
|||||||
willTransition(transition) {
|
willTransition(transition) {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
const controller = this.controllerFor("preferences/second-factor");
|
|
||||||
const user = controller.get("currentUser");
|
|
||||||
const settings = controller.get("siteSettings");
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
transition.targetName === "preferences.second-factor" ||
|
transition.targetName === "preferences.second-factor" ||
|
||||||
!user ||
|
!this.currentUser ||
|
||||||
user.is_anonymous ||
|
this.currentUser.is_anonymous ||
|
||||||
user.second_factor_enabled ||
|
this.currentUser.second_factor_enabled ||
|
||||||
(settings.enforce_second_factor === "staff" && !user.staff) ||
|
(this.siteSettings.enforce_second_factor === "staff" &&
|
||||||
settings.enforce_second_factor === "no"
|
!this.currentUser.staff) ||
|
||||||
|
this.siteSettings.enforce_second_factor === "no"
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@
|
|||||||
|
|
||||||
{{#unless this.showEnforcedNotice}}
|
{{#unless this.showEnforcedNotice}}
|
||||||
<CancelLink
|
<CancelLink
|
||||||
@route="preferences.account"
|
@route="preferences.security"
|
||||||
@args={{this.model.username}}
|
@args={{this.model.username}}
|
||||||
/>
|
/>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
@ -686,10 +686,6 @@ Discourse::Application.routes.draw do
|
|||||||
:constraints => {
|
:constraints => {
|
||||||
username: RouteFormat.username,
|
username: RouteFormat.username,
|
||||||
}
|
}
|
||||||
get "#{root_path}/:username/preferences/second-factor-backup" => "users#preferences",
|
|
||||||
:constraints => {
|
|
||||||
username: RouteFormat.username,
|
|
||||||
}
|
|
||||||
delete "#{root_path}/:username/preferences/user_image" => "users#destroy_user_image",
|
delete "#{root_path}/:username/preferences/user_image" => "users#destroy_user_image",
|
||||||
:constraints => {
|
:constraints => {
|
||||||
username: RouteFormat.username,
|
username: RouteFormat.username,
|
||||||
|
Loading…
Reference in New Issue
Block a user