diff options
Diffstat (limited to 'client/components')
-rw-r--r-- | client/components/users/userHeader.jade | 2 | ||||
-rw-r--r-- | client/components/users/userHeader.js | 15 |
2 files changed, 13 insertions, 4 deletions
diff --git a/client/components/users/userHeader.jade b/client/components/users/userHeader.jade index a71e7fc7..ce8cf1af 100644 --- a/client/components/users/userHeader.jade +++ b/client/components/users/userHeader.jade @@ -27,6 +27,8 @@ template(name="editProfilePopup") input.js-profile-fullname(type="text" value=profile.fullname autofocus) label | {{_ 'username'}} + span.error.hide.username-taken + | {{_ 'error-username-taken'}} input.js-profile-username(type="text" value=username) label | {{_ 'initials'}} diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js index 10fdf699..e060c13a 100644 --- a/client/components/users/userHeader.js +++ b/client/components/users/userHeader.js @@ -26,11 +26,18 @@ Template.editProfilePopup.events({ 'profile.fullname': fullname, 'profile.initials': initials, }}); - // XXX We should report the error to the user. + if (username !== Meteor.user().username) { - Meteor.call('setUsername', username); - } - Popup.back(); + Meteor.call('setUsername', username, function(error) { + const messageElement = tpl.$('.username-taken'); + if (error) { + messageElement.show(); + } else { + messageElement.hide(); + Popup.back(); + } + }); + } else Popup.back(); }, }); |