Fix small issues with the messenger

pull/1/head
yflory 6 years ago
parent 8b05b1acaf
commit c38eb6588e

@ -147,6 +147,7 @@
box-sizing: border-box;
position: relative;
order: -2;
resize: horizontal;
#cp-app-contacts-container {
height: 100%;
}
@ -991,7 +992,8 @@
height: @toolbar_line-height;
}
#cp-toolbar-userlist-drawer-open { order: 1; }
#cp-toolbar-userlist-drawer-open { order: 0; }
#cp-toolbar-chat-drawer-open { order: 1; }
.cp-toolbar-share-button { order: 2; }
.cp-toolbar-spinner { order: 3; }

@ -136,6 +136,8 @@ define(function () {
out.userListButton = "User list";
out.chatButton = "Chat";
out.userAccountButton = "Your account";
out.newButton = 'New';
@ -376,6 +378,10 @@ define(function () {
out.contacts_removeHistoryServerError = 'There was an error while removing your chat history. Try again later';
out.contacts_fetchHistory = "Retrieve older history";
out.contacts_friends = "Friends";
out.contacts_rooms = "Rooms";
out.contacts_leaveRoom = "Leave this room";
// File manager
out.fm_rootName = "Documents";

@ -19,17 +19,16 @@
flex-flow: column;
height: 100%;
min-height: 100%;
width: 50%;
min-width: 20%;
max-width: 80%;
resize: horizontal;
overflow: hidden;
width: 50%;
&.cp-app-code-fullpage {
max-width: 100%;
resize: none;
flex: 1;
}
}
.CodeMirror {
flex: 1;
@ -51,9 +50,13 @@
#cp-app-code-container { display: none; }
#cp-app-code-preview { border: 0; }
}
&.cp-chat-visible {
#cp-app-code-container {
width: 35%;
}
}
}
#cp-app-code-preview {
flex: 1;
padding: 5px 20px;
overflow: auto;
display: inline-block;
@ -63,6 +66,7 @@
font-family: Calibri,Ubuntu,sans-serif;
word-wrap: break-word;
position: relative;
flex: 1;
media-tag {
* {
max-width:100%;

@ -54,7 +54,7 @@ define([
var msgAlreadyKnown = function (channel, sig) {
return channel.messages.some(function (message) {
return message[0] === sig;
return message.sig === sig;
});
};
@ -291,9 +291,9 @@ define([
};
var pushMsg = function (channel, cryptMsg) {
var msg = channel.encryptor.decrypt(cryptMsg);
var sig = cryptMsg.slice(0, 64);
if (msgAlreadyKnown(channel, sig)) { return; }
var msg = channel.encryptor.decrypt(cryptMsg);
var parsedMsg = JSON.parse(msg);
var curvePublic;
@ -435,7 +435,8 @@ define([
return null;
}
}).filter(function (decrypted) {
if (decrypted.d && decrypted.d[0] !== Types.message) { return; }
if (!decrypted.d || decrypted.d[0] !== Types.message) { return; }
if (msgAlreadyKnown(channel, decrypted.sig)) { return; }
return decrypted;
}).map(function (O) {
return {
@ -803,8 +804,6 @@ define([
});
// TODO load rooms
}).nThen(function () {
// TODO send event chat ready
// Remove spinner in chatbox
ready = true;
eachHandler('event', function (f) {
f('READY');
@ -850,6 +849,8 @@ define([
name = friend.displayName;
lastKnownHash = friend.lastKnownHash;
curvePublic = friend.curvePublic;
} else if (r.isPadChat) {
return;
} else {
// TODO room get metadata (name) && lastKnownHash
}

@ -7,7 +7,7 @@ define([
'/common/common-hash.js',
'/common/common-feedback.js',
'/common/sframe-messenger-inner.js',
'/contacts/messenger-ui.js',
'/contacts/messenger-ui.js?'+ +new Date(),
'/customize/messages.js',
], function ($, Config, ApiConfig, UIElements, UI, Hash, Feedback,
Messenger, MessengerUI, Messages) {
@ -437,9 +437,9 @@ Messenger, MessengerUI, Messages) {
toolbar.chatContent = $content;
var $container = $('<span>', {id: 'cp-toolbar-chat-drawer-open', title: Messages.chatButton || 'CHAT'}); //XXX
var $container = $('<span>', {id: 'cp-toolbar-chat-drawer-open', title: Messages.chatButton});
var $button = $('<button>').text('Chat').appendTo($container); //XXX
var $button = $('<button>', {'class': 'fa fa-comments'}).appendTo($container);
$('<span>',{'class': 'cp-dropdown-button-title'}).appendTo($button);
toolbar.$leftside.prepend($container);
@ -451,11 +451,13 @@ Messenger, MessengerUI, Messages) {
var hide = function () {
$content.hide();
$button.removeClass('cp-toolbar-button-active');
config.$contentContainer.removeClass('cp-chat-visible');
};
var show = function () {
if (Bar.isEmbed) { $content.hide(); return; }
$content.show();
$button.addClass('cp-toolbar-button-active');
config.$contentContainer.addClass('cp-chat-visible');
};
$closeIcon.click(function () {
Common.setAttribute(['toolbar', 'chat-drawer'], false);
@ -467,7 +469,6 @@ Messenger, MessengerUI, Messages) {
else { show(); }
visible = !visible;
Common.setAttribute(['toolbar', 'chat-drawer'], visible);
//Feedback.send(visible?'USERLIST_SHOW': 'USERLIST_HIDE'); // XXX
});
show();
Common.getAttribute(['toolbar', 'chat-drawer'], function (err, val) {

@ -65,11 +65,11 @@ define([
]),
h('div.cp-app-contacts-friends.cp-app-contacts-category', [
h('div.cp-app-contacts-category-content'),
h('h2.cp-app-contacts-category-title', 'Friends'), // XXX
h('h2.cp-app-contacts-category-title', Messages.contacts_friends),
]),
h('div.cp-app-contacts-rooms.cp-app-contacts-category', [
h('div.cp-app-contacts-category-content'),
h('h2.cp-app-contacts-category-title', 'Rooms'), // XXX
h('h2.cp-app-contacts-category-title', Messages.contacts_rooms),
]),
]);
@ -443,7 +443,7 @@ define([
title: Messages.contacts_remove
});
var leaveRoom = h('span.cp-app-contacts-remove.fa.fa-sign-out', {
title: 'Leave this room' // XXX
title: Messages.contacts_leaveRoom
});
var status = h('span.cp-app-contacts-status');
@ -581,8 +581,6 @@ define([
'.cp-app-contacts-name, div.cp-app-contacts-message'+
userQuery(curvePublic) + ' div.cp-app-contacts-sender').text(name);
// XXX update name in state.channels[id] ??
// TODO room
// Update name in room userlist
}
@ -628,7 +626,7 @@ define([
if (!room.isPadChat && (!Array.isArray(list) || !list.length)) {
return void console.error("Empty room!");
}
debug('userlist: ' + JSON.stringify(list));
debug('userlist: ' + JSON.stringify(list), id);
var friend = {};

Loading…
Cancel
Save