summaryrefslogtreecommitdiffstats
path: root/client/components/users/userHeader.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/users/userHeader.js')
-rw-r--r--client/components/users/userHeader.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js
index 1f2f1d9b..1c390395 100644
--- a/client/components/users/userHeader.js
+++ b/client/components/users/userHeader.js
@@ -27,11 +27,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();
},
});