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 {
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')

View File

@ -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() {