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

pull/1/head
ansuz 7 years ago
commit df0442c2bf

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

@ -253,6 +253,18 @@ define(function () {
out.profile_description = "Description"; out.profile_description = "Description";
out.profile_fieldSaved = 'Nouvelle valeur enregistrée: {0}'; 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 // File manager
out.fm_rootName = "Documents"; out.fm_rootName = "Documents";

@ -266,6 +266,13 @@ define(function () {
out.userlist_addAsFriendTitle = 'Add "{0}" as a contact'; out.userlist_addAsFriendTitle = 'Add "{0}" as a contact';
out.userlist_thisIsYou = 'This is you ("{0}")'; out.userlist_thisIsYou = 'This is you ("{0}")';
out.contacts_title = "Contacts"; 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 // File manager

@ -11,17 +11,8 @@ define([
unfriend: 'UNFRIEND' 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 // TODO
// - mute a channel (hide notifications or don't open it?) // - mute a channel (hide notifications or don't open it?)
//
var ready = []; var ready = [];
var pending = {}; var pending = {};
@ -87,6 +78,7 @@ define([
var $rightCol = $('<span>', {'class': 'right-col'}); var $rightCol = $('<span>', {'class': 'right-col'});
$('<span>', {'class': 'name'}).text(data.displayName).appendTo($rightCol); $('<span>', {'class': 'name'}).text(data.displayName).appendTo($rightCol);
var $remove = $('<span>', {'class': 'remove fa fa-user-times'}).appendTo($rightCol); var $remove = $('<span>', {'class': 'remove fa fa-user-times'}).appendTo($rightCol);
$remove.attr('title', common.Messages.contacts_remove);
$friend.dblclick(function () { $friend.dblclick(function () {
if (data.profile) { if (data.profile) {
window.open('/profile/#' + data.profile); window.open('/profile/#' + data.profile);
@ -97,10 +89,12 @@ define([
}); });
$remove.click(function (e) { $remove.click(function (e) {
e.stopPropagation(); 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; } if (!yes) { return; }
remove(data.curvePublic); remove(data.curvePublic);
}); }, null, true);
}); });
if (data.avatar && avatars[data.avatar]) { if (data.avatar && avatars[data.avatar]) {
$friend.append(avatars[data.avatar]); $friend.append(avatars[data.avatar]);
@ -291,7 +285,7 @@ define([
console.error(err); 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) { $input.on('keypress', function (e) {
if (e.which === 13) { send(); } if (e.which === 13) { send(); }
}); });
@ -568,16 +562,18 @@ define([
todo(true); todo(true);
return; 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; return;
} }
if (msg[0] === "FRIEND_REQ_OK") { if (msg[0] === "FRIEND_REQ_OK") {
// XXX
addToFriendList(common, msgData, function (err) { addToFriendList(common, msgData, function (err) {
if (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 msg = ["FRIEND_REQ_ACK", chan];
var msgStr = Crypto.encrypt(JSON.stringify(msg), key); var msgStr = Crypto.encrypt(JSON.stringify(msg), key);
network.sendto(sender, msgStr); network.sendto(sender, msgStr);
@ -585,19 +581,17 @@ define([
return; return;
} }
if (msg[0] === "FRIEND_REQ_NOK") { if (msg[0] === "FRIEND_REQ_NOK") {
// XXX common.log(common.Messages.contacts_rejected);
common.log('Friend invite rejected');
return; return;
} }
if (msg[0] === "FRIEND_REQ_ACK") { if (msg[0] === "FRIEND_REQ_ACK") {
// XXX
var data = pending[sender]; var data = pending[sender];
if (!data) { return; } if (!data) { return; }
addToFriendList(common, data, function (err) { addToFriendList(common, data, function (err) {
if (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; return;
} }

Loading…
Cancel
Save