Fix small issues with the messenger
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user