mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
FIX: Change username view was not loading. Also you can always edit yourself.
This commit is contained in:
parent
e2ce4947d7
commit
82116d5db5
|
@ -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;
|
||||
|
|
|
@ -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});
|
||||
},
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user