diff --git a/samples/newChat/index.html b/samples/newChat/index.html index 32785e0f9..473037d26 100644 --- a/samples/newChat/index.html +++ b/samples/newChat/index.html @@ -216,7 +216,7 @@

<%- title %>

account_circle
-

<%- sender ? sender.name : message.sender_id %>

+

<%- sender ? sender.name : 'unknown user (' + message.sender_id + ')' %>

<% if (message.message) { %>

<%= message.message %>

<% } %> diff --git a/samples/newChat/js/dialog.js b/samples/newChat/js/dialog.js index 02de0daf1..d2ea18e2e 100644 --- a/samples/newChat/js/dialog.js +++ b/samples/newChat/js/dialog.js @@ -30,7 +30,7 @@ Dialog.prototype.init = function () { position = container.scrollHeight - (container.scrollTop + container.offsetHeight); if (container.classList.contains('full')) { - container.removeEventListener('scroll', loadMoreDialogs); + return false; } if (position <= 50 && !container.classList.contains('loading')) { @@ -476,6 +476,10 @@ Dialog.prototype.updateDialog = function (updates) { messageModule.sendMessage(dialogId, updatedMsg); + if(updates.title){ + self.updateDialogUi(dialogId, updates.title); + } + router.navigate('/dialog/' + dialog._id); }).catch(function(error){ console.error(error); diff --git a/samples/newChat/js/message.js b/samples/newChat/js/message.js index e45e80c5d..d7cafa749 100644 --- a/samples/newChat/js/message.js +++ b/samples/newChat/js/message.js @@ -251,6 +251,7 @@ Message.prototype.renderMessage = function (message, setAsFirst) { messagesHtml = helpers.fillTemplate('tpl_message', { message: { + sender_id: message.sender_id, message: messageText, attachments: message.attachments, date_sent: message.date_sent diff --git a/samples/newChat/js/user.js b/samples/newChat/js/user.js index 77bf41c1c..1eab36c15 100644 --- a/samples/newChat/js/user.js +++ b/samples/newChat/js/user.js @@ -64,7 +64,9 @@ User.prototype.getUsersByIds = function (userList) { return item.user.id === id; }); - self.addToCache(user.user); + if(user !== undefined) { + self.addToCache(user.user); + } }); resolve(); }