diff --git a/oml/user/api.py b/oml/user/api.py index e27e893..13bcd13 100644 --- a/oml/user/api.py +++ b/oml/user/api.py @@ -294,6 +294,7 @@ def requestPeering(data): takes { id message + nickname (optional) } ''' if len(data.get('id', '')) != 43: @@ -303,6 +304,9 @@ def requestPeering(data): u.pending = 'sent' u.queued = True u.info['message'] = data.get('message', '') + if data.get('nickname'): + u.info['nickname'] = data.get('nickname', '') + u.update_name() u.save() state.nodes.queue('add', u.id) state.nodes.queue(u.id, 'peering', 'requestPeering') diff --git a/static/js/usersDialog.js b/static/js/usersDialog.js index ffe12ad..c04ad1c 100644 --- a/static/js/usersDialog.js +++ b/static/js/usersDialog.js @@ -197,7 +197,7 @@ oml.ui.usersDialog = function() { .css({margin: '32px 16px'}) // FIXME: WTF! .appendTo($user), - $id, $buttons = [], $message, + $id, $buttons = [], $message, $nickname, folder; @@ -257,7 +257,7 @@ oml.ui.usersDialog = function() { } - Ox.Input({ + $nickname = Ox.Input({ label: Ox._('Nickname'), labelWidth: 128, value: user.nickname, @@ -265,20 +265,22 @@ oml.ui.usersDialog = function() { }) .bindEvent({ change: function(data) { - oml.api.editUser({ - id: user.id, - nickname: data.value - }, function(result) { - oml.renameUser(result.data) - // FIXME: ugly - Ox.forEach($lists, function($list) { - var selected = $list.options('selected'); - if (selected.length) { - $list.value(user.id, 'name', result.data.name); - return false; - } + if (user.section != 'invitations') { + oml.api.editUser({ + id: user.id, + nickname: data.value + }, function(result) { + oml.renameUser(result.data) + // FIXME: ugly + Ox.forEach($lists, function($list) { + var selected = $list.options('selected'); + if (selected.length) { + $list.value(user.id, 'name', result.data.name); + return false; + } + }); }); - }); + } } }) .appendTo($form); @@ -335,6 +337,18 @@ oml.ui.usersDialog = function() { }) .appendTo($form); + Ox.Input({ + disabled: true, + label: Ox._('Public Key'), + labelWidth: 128, + value: user.id, + width: 480 + }) + .css({ + marginTop: '8px' + }) + .appendTo($form); + Ox.Input({ disabled: true, label: Ox._('Contact'), @@ -393,6 +407,7 @@ oml.ui.usersDialog = function() { message: $message.value() }; if (id == 'send') { + data.nickname = $nickname.value(); oml.api.requestPeering(data, function(result) { Ox.Request.clearCache(); updateUsers(function() {