show public key of users, send nickname with peering request

This commit is contained in:
j 2015-02-26 16:22:40 +05:30
parent c9170202bf
commit f87f0b965e
2 changed files with 34 additions and 15 deletions

View file

@ -294,6 +294,7 @@ def requestPeering(data):
takes { takes {
id id
message message
nickname (optional)
} }
''' '''
if len(data.get('id', '')) != 43: if len(data.get('id', '')) != 43:
@ -303,6 +304,9 @@ def requestPeering(data):
u.pending = 'sent' u.pending = 'sent'
u.queued = True u.queued = True
u.info['message'] = data.get('message', '') u.info['message'] = data.get('message', '')
if data.get('nickname'):
u.info['nickname'] = data.get('nickname', '')
u.update_name()
u.save() u.save()
state.nodes.queue('add', u.id) state.nodes.queue('add', u.id)
state.nodes.queue(u.id, 'peering', 'requestPeering') state.nodes.queue(u.id, 'peering', 'requestPeering')

View file

@ -197,7 +197,7 @@ oml.ui.usersDialog = function() {
.css({margin: '32px 16px'}) // FIXME: WTF! .css({margin: '32px 16px'}) // FIXME: WTF!
.appendTo($user), .appendTo($user),
$id, $buttons = [], $message, $id, $buttons = [], $message, $nickname,
folder; folder;
@ -257,7 +257,7 @@ oml.ui.usersDialog = function() {
} }
Ox.Input({ $nickname = Ox.Input({
label: Ox._('Nickname'), label: Ox._('Nickname'),
labelWidth: 128, labelWidth: 128,
value: user.nickname, value: user.nickname,
@ -265,6 +265,7 @@ oml.ui.usersDialog = function() {
}) })
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
if (user.section != 'invitations') {
oml.api.editUser({ oml.api.editUser({
id: user.id, id: user.id,
nickname: data.value nickname: data.value
@ -280,6 +281,7 @@ oml.ui.usersDialog = function() {
}); });
}); });
} }
}
}) })
.appendTo($form); .appendTo($form);
@ -335,6 +337,18 @@ oml.ui.usersDialog = function() {
}) })
.appendTo($form); .appendTo($form);
Ox.Input({
disabled: true,
label: Ox._('Public Key'),
labelWidth: 128,
value: user.id,
width: 480
})
.css({
marginTop: '8px'
})
.appendTo($form);
Ox.Input({ Ox.Input({
disabled: true, disabled: true,
label: Ox._('Contact'), label: Ox._('Contact'),
@ -393,6 +407,7 @@ oml.ui.usersDialog = function() {
message: $message.value() message: $message.value()
}; };
if (id == 'send') { if (id == 'send') {
data.nickname = $nickname.value();
oml.api.requestPeering(data, function(result) { oml.api.requestPeering(data, function(result) {
Ox.Request.clearCache(); Ox.Request.clearCache();
updateUsers(function() { updateUsers(function() {