Improve friend request process and UI

This commit is contained in:
yflory
2019-05-22 18:03:52 +02:00
parent 38f8535dd5
commit 9cb1a059f2
11 changed files with 257 additions and 66 deletions

View File

@@ -2610,7 +2610,8 @@ define([
UIElements.displayFriendRequestModal = function (common, data) {
var msg = data.content.msg;
var text = Messages._getKey('contacts_request', [msg.content.displayName]);
UI.confirm(text, function (yes) {
var todo = function (yes) {
common.getSframeChannel().query("Q_ANSWER_FRIEND_REQUEST", {
data: data,
value: yes
@@ -2621,10 +2622,32 @@ define([
}
UI.log(Messages.contacts_added);
});
};
var content = h('div.cp-share-modal', [
setHTML(h('p'), text)
]);
var buttons = [{
name: Messages.cancel, // XXX "later"?
onClick: function () {},
keys: [27]
}, {
ok: 'Accept', // XXX
cancel: 'Ignore the request' // XXX
}, true);
className: 'primary',
name: "Accept (Enter)", // XXX
onClick: function () {
todo(true);
},
keys: [13]
}, {
className: 'primary',
name: "Ignore the request", // XXX
onClick: function () {
todo(false);
},
keys: [[13, 'ctrl']]
}];
var modal = UI.dialog.customModal(content, {buttons: buttons});
UI.openCustomModal(modal);
};
return UIElements;