FIX: Change username view was not loading. Also you can always edit yourself.

This commit is contained in:
Robin Ward 2013-06-11 12:30:38 -04:00
parent e2ce4947d7
commit 82116d5db5
3 changed files with 15 additions and 1 deletions

View File

@ -11,6 +11,7 @@ Discourse.PreferencesUsernameController = Discourse.ObjectController.extend({
saving: false,
error: false,
errorMessage: null,
newUsername: null,
saveDisabled: function() {
if (this.get('saving')) return true;

View File

@ -9,6 +9,14 @@
Discourse.UserRoute = Discourse.Route.extend({
model: function(params) {
// If we're viewing the currently logged in user, return that object
// instead.
var currentUser = Discourse.User.current();
if (params.username.toLowerCase() === currentUser.get('username_lower')) {
return currentUser;
}
return Discourse.User.create({username: params.username});
},

View File

@ -12,7 +12,8 @@ class CurrentUserSerializer < BasicUserSerializer
:topic_count,
:enable_quoting,
:external_links_in_new_tab,
:trust_level
:trust_level,
:can_edit
def include_site_flagged_posts_count?
object.staff?
@ -30,4 +31,8 @@ class CurrentUserSerializer < BasicUserSerializer
PostAction.flagged_posts_count
end
def can_edit
true
end
end