add history removal

pull/1/head
ansuz 7 years ago
parent e26e041a5b
commit b22127f10c

@ -282,6 +282,9 @@ define(function () {
out.contacts_info3 = "Double-click their icon to view their profile"; out.contacts_info3 = "Double-click their icon to view their profile";
out.contacts_info4 = "Either participant can clear permanently a chat history"; out.contacts_info4 = "Either participant can clear permanently a chat history";
out.contacts_confirmRemoveHistory = 'Are you sure you want to permanently remove your chat history? Data cannot be restored';
out.contacts_removeHistoryServerError = 'There was an error while removing your chat history. Try again later';
// File manager // File manager
out.fm_rootName = "Documents"; out.fm_rootName = "Documents";

@ -284,24 +284,27 @@ define([
var data = getFriend(common, curvePublic); var data = getFriend(common, curvePublic);
var proxy = common.getProxy(); var proxy = common.getProxy();
var $header = $('<div>', {'class': 'header avatar'}).appendTo($container); var $header = $('<div>', {
/* 'class': 'cp-contact-top-bar header',
}).appendTo($container);
var $avatar = $('<div>', {'class': 'avatar'}).appendTo($header);
var $removeHistory = $('<button>', { var $removeHistory = $('<button>', {
'class': 'remove-history' 'class': 'remove-history'
}).text('remove chat history').click(function () { }).text('remove chat history').click(function () {
Cryptpad.confirm('are you sure?', function (yes) { Cryptpad.confirm(common.Messages.contacts_confirmRemoveHistory, function (yes) {
if (!yes) { return; } if (!yes) { return; }
Cryptpad.clearOwnedChannel(data.channel, function (e) { Cryptpad.clearOwnedChannel(data.channel, function (e) {
if (e) { if (e) {
console.error(e); console.error(e);
Cryptpad.alert("Something went wrong"); Cryptpad.alert(common.Messages.contacts_removeHistoryServerError);
return; return;
} }
}); });
}); });
}); });
$removeHistory.appendTo($header); //rightCol); $removeHistory.appendTo($header);
*/
$('<div>', {'class': 'messages'}).appendTo($container); $('<div>', {'class': 'messages'}).appendTo($container);
var $inputBlock = $('<div>', {'class': 'input'}).appendTo($container); var $inputBlock = $('<div>', {'class': 'input'}).appendTo($container);
@ -363,14 +366,14 @@ 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);
if (data.avatar && avatars[data.avatar]) { if (data.avatar && avatars[data.avatar]) {
$header.append(avatars[data.avatar]); $avatar.append(avatars[data.avatar]);
$header.append($rightCol); $avatar.append($rightCol);
} else { } else {
common.displayAvatar($header, data.avatar, data.displayName, function ($img) { common.displayAvatar($avatar, data.avatar, data.displayName, function ($img) {
if (data.avatar && $img) { if (data.avatar && $img) {
avatars[data.avatar] = $img[0].outerHTML; avatars[data.avatar] = $img[0].outerHTML;
} }
$header.append($rightCol); $avatar.append($rightCol);
}); });
} }

@ -142,7 +142,11 @@ define([
} }
rpc.send('CLEAR_OWNED_CHANNEL', channel, function (e, response) { rpc.send('CLEAR_OWNED_CHANNEL', channel, function (e, response) {
if (e) { return cb(e); } if (e) { return cb(e); }
cb(response); if (response && response.length) {
cb(void 0, response[0]);
} else {
cb();
}
}); });
}; };

@ -66,7 +66,7 @@ body {
} }
} }
#friendList .friend, #messaging .header { #friendList .friend, #messaging .avatar {
.avatar(30px); .avatar(30px);
&.avatar { &.avatar {
display: flex; display: flex;
@ -112,6 +112,19 @@ body {
} }
} }
.cp-contact-top-bar {
display: flex;
justify-content: space-between;
align-items: center;
.avatar,
.right-col {
flex:1 1 auto; //; // 1 auto;
}
.remove-history {
// TODO
}
}
#messaging { #messaging {
flex: 1; flex: 1;
height: 100%; height: 100%;

Loading…
Cancel
Save