Some fixes

This commit is contained in:
Pavel Djundik 2018-07-10 12:20:52 +03:00 committed by Pavel Djundik
parent 121dd35c3b
commit 96569e71a3
2 changed files with 6 additions and 2 deletions

View File

@ -114,7 +114,7 @@ export default {
"channel.messages"() { "channel.messages"() {
const el = this.$refs.chat; const el = this.$refs.chat;
if (el.scrollHeight - el.scrollTop - el.offsetHeight > 30) { if (!el || el.scrollHeight - el.scrollTop - el.offsetHeight > 30) {
return; return;
} }

View File

@ -127,7 +127,11 @@ window.vueMounted = () => {
let channel; let channel;
if (vueApp.activeChannel) { if (vueApp.activeChannel) {
vueApp.activeChannel.channel.firstUnread = vueApp.activeChannel.channel.messages[vueApp.activeChannel.channel.messages.length - 1].id; const {channel: lastChannel} = vueApp.activeChannel;
if (lastChannel.messages.length > 0) {
lastChannel.firstUnread = lastChannel.messages[lastChannel.messages.length - 1].id;
}
} }
if (inSidebar) { if (inSidebar) {