DEV: Remove an obsolete "preferences/about-me" route (#8251)

User's title and bio can be changed on the "preferences/account" page.
This commit is contained in:
Jarek Radosz 2019-10-28 17:29:14 +01:00 committed by GitHub
parent 790e1b7191
commit 5776251cdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 90 deletions

View File

@ -1,12 +0,0 @@
import Controller from "@ember/controller";
import computed from "ember-addons/ember-computed-decorators";
export default Controller.extend({
saving: false,
newBio: null,
@computed("saving")
saveButtonText(saving) {
return saving ? I18n.t("saving") : I18n.t("user.change");
}
});

View File

@ -156,7 +156,6 @@ export default function() {
this.route("email");
this.route("second-factor");
this.route("second-factor-backup");
this.route("about", { path: "/about-me" });
});
this.route(

View File

@ -1,46 +0,0 @@
import RestrictedUserRoute from "discourse/routes/restricted-user";
export default RestrictedUserRoute.extend({
showFooter: true,
model: function() {
return this.modelFor("user");
},
renderTemplate: function() {
this.render({ into: "user" });
},
setupController: function(controller, model) {
controller.setProperties({ model, newBio: model.get("bio_raw") });
},
// A bit odd, but if we leave to /preferences we need to re-render that outlet
deactivate: function() {
this._super(...arguments);
this.render("preferences", { into: "user", controller: "preferences" });
},
actions: {
changeAbout: function() {
var route = this;
var controller = route.controllerFor("preferences/about");
controller.setProperties({ saving: true });
return controller
.get("model")
.save()
.then(
function() {
controller.set("saving", false);
route.transitionTo("user.index");
},
function() {
// model failed to save
controller.set("saving", false);
bootbox.alert(I18n.t("generic_error"));
}
);
}
}
});

View File

@ -1,25 +0,0 @@
<div class="user-preferences solo-preference">
<form class="form-horizontal">
<div class="control-group">
<div class="controls">
<h3>{{i18n 'user.change_about.title'}}</h3>
</div>
</div>
<div class="control-group">
<label class="control-label">{{i18n 'user.bio'}}</label>
<div class="controls">
{{d-editor value=model.bio_raw class="raw-bio" autofocus="autofocus"}}
</div>
</div>
<div class="control-group">
<div class="controls">
{{#d-button action=(route-action "changeAbout") class="btn btn-primary"}}
{{saveButtonText}}
{{/d-button}}
</div>
</div>
</form>
</div>

View File

@ -435,7 +435,6 @@ Discourse::Application.routes.draw do
get "#{root_path}/:username/preferences/interface" => "users#preferences", constraints: { username: RouteFormat.username }
get "#{root_path}/:username/preferences/apps" => "users#preferences", constraints: { username: RouteFormat.username }
put "#{root_path}/:username/preferences/email" => "users_email#update", constraints: { username: RouteFormat.username }
get "#{root_path}/:username/preferences/about-me" => "users#preferences", constraints: { username: RouteFormat.username }
get "#{root_path}/:username/preferences/badge_title" => "users#preferences", constraints: { username: RouteFormat.username }
put "#{root_path}/:username/preferences/badge_title" => "users#badge_title", constraints: { username: RouteFormat.username }
get "#{root_path}/:username/preferences/username" => "users#preferences", constraints: { username: RouteFormat.username }

View File

@ -160,11 +160,6 @@ QUnit.test("username", async assert => {
assert.ok(exists("#change_username"), "it has the input element");
});
QUnit.test("about me", async assert => {
await visit("/u/eviltrout/preferences/about-me");
assert.ok(exists(".raw-bio"), "it has the input element");
});
QUnit.test("email", async assert => {
await visit("/u/eviltrout/preferences/email");