Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
ansuz 2017-07-17 18:40:27 +02:00
commit df0442c2bf
4 changed files with 41 additions and 26 deletions

View file

@ -119,11 +119,8 @@ body .userlist-drawer {
}
}
.friend {
display: flex;
text-align: right;
&:hover {
background-color: rgba(0, 0, 0, 0.1);
}
display: inline-block;
width: 20px;
}
}
@ -136,6 +133,11 @@ body {
background-color: darken(@bgcolor, 10%);
color: @color;
}
.friend {
&:hover {
color: darken(@color, 15%);
}
}
}
.cryptpad-toolbar {
background-color: @bgcolor;

View file

@ -253,6 +253,18 @@ define(function () {
out.profile_description = "Description";
out.profile_fieldSaved = 'Nouvelle valeur enregistrée: {0}';
// contacts/userlist
out.userlist_addAsFriendTitle = 'Ajouter "{0}" comme contact';
out.userlist_thisIsYou = 'Vous ("{0}")';
out.contacts_title = "Contacts";
out.contacts_addError = "Erreur lors de l'ajout de ce contact dans votre liste";
out.contacts_added = 'Invitation de contact acceptée';
out.contacts_rejected = 'Invitation d econtact rejetée';
out.contacts_request = '<em>{0}</em> souhaite vous ajouter en tant que contact. <b>Accepter<b> ?';
out.contacts_send = 'Envoyer';
out.contacts_remove = 'Supprimer ce contact';
out.contacts_confirmRemove = 'Êtes-vous sûr de voulour supprimer <em>{0}</em> de vos contacts ?';
// File manager
out.fm_rootName = "Documents";

View file

@ -266,6 +266,13 @@ define(function () {
out.userlist_addAsFriendTitle = 'Add "{0}" as a contact';
out.userlist_thisIsYou = 'This is you ("{0}")';
out.contacts_title = "Contacts";
out.contacts_addError = 'Error while adding that contact to the list';
out.contacts_added = 'Contact invite accepted.';
out.contacts_rejected = 'Contact invite rejected';
out.contacts_request = '<em>{0}</em> would like to add you as a contact. <b>Accept<b>?';
out.contacts_send = 'Send';
out.contacts_remove = 'Remove this contact';
out.contacts_confirmRemove = 'Are you sure you want to remove <em>{0}</em> from your contacts?';
// File manager

View file

@ -11,17 +11,8 @@ define([
unfriend: 'UNFRIEND'
};
// TODO: pin the chat channel!
// TODO: new Types
// - send a rename message to the chat
// - petnames
// - close a chat / remove a friend
// TODO
// - mute a channel (hide notifications or don't open it?)
//
var ready = [];
var pending = {};
@ -87,6 +78,7 @@ define([
var $rightCol = $('<span>', {'class': 'right-col'});
$('<span>', {'class': 'name'}).text(data.displayName).appendTo($rightCol);
var $remove = $('<span>', {'class': 'remove fa fa-user-times'}).appendTo($rightCol);
$remove.attr('title', common.Messages.contacts_remove);
$friend.dblclick(function () {
if (data.profile) {
window.open('/profile/#' + data.profile);
@ -97,10 +89,12 @@ define([
});
$remove.click(function (e) {
e.stopPropagation();
common.confirm("TODO: Are you sure?", function (yes) {//XXX
common.confirm(common.Messages.getKey('contacts_confirmRemove', [
common.fixHTML(data.displayName)
]), function (yes) {
if (!yes) { return; }
remove(data.curvePublic);
});
}, null, true);
});
if (data.avatar && avatars[data.avatar]) {
$friend.append(avatars[data.avatar]);
@ -291,7 +285,7 @@ define([
console.error(err);
});
};
$('<button>').text('TODO: Send').appendTo($inputBlock).click(send); // XXX
$('<button>').text(common.Messages.contacts_send).appendTo($inputBlock).click(send);
$input.on('keypress', function (e) {
if (e.which === 13) { send(); }
});
@ -568,16 +562,18 @@ define([
todo(true);
return;
}
common.confirm("Accept friend?", todo);// TODO
var confirmMsg = common.Messages._getKey('contacts_request', [
common.fixHTML(msgData.displayName)
]);
common.confirm(confirmMsg, todo, null, true);
return;
}
if (msg[0] === "FRIEND_REQ_OK") {
// XXX
addToFriendList(common, msgData, function (err) {
if (err) {
return void common.log('Error while adding that friend to the list');
return void common.log(common.Messages.contacts_addError);
}
common.log('Friend invite accepted.');
common.log(common.Messages.contacts_added);
var msg = ["FRIEND_REQ_ACK", chan];
var msgStr = Crypto.encrypt(JSON.stringify(msg), key);
network.sendto(sender, msgStr);
@ -585,19 +581,17 @@ define([
return;
}
if (msg[0] === "FRIEND_REQ_NOK") {
// XXX
common.log('Friend invite rejected');
common.log(common.Messages.contacts_rejected);
return;
}
if (msg[0] === "FRIEND_REQ_ACK") {
// XXX
var data = pending[sender];
if (!data) { return; }
addToFriendList(common, data, function (err) {
if (err) {
return void common.log('Error while adding that friend to the list');
return void common.log(common.Messages.contacts_addError);
}
common.log('Friend added to the list.');
common.log(common.Messages.contacts_added);
});
return;
}