Commit cbe6092c authored by JC Brand's avatar JC Brand

Handle case where chat content is empty

parent 1443fdd4
...@@ -1429,11 +1429,11 @@ ...@@ -1429,11 +1429,11 @@
showLeaveNotification (occupant) { showLeaveNotification (occupant) {
const nick = occupant.get('nick'), const nick = occupant.get('nick'),
stat = occupant.get('status'), stat = occupant.get('status'),
last_el = this.content.lastElementChild, last_el = this.content.lastElementChild;
last_msg_date = last_el.getAttribute('data-isodate');
if (_.includes(_.get(last_el, 'classList', []), 'chat-info') && if (last_el &&
moment(last_msg_date).isSame(new Date(), "day") && _.includes(_.get(last_el, 'classList', []), 'chat-info') &&
moment(last_el.getAttribute('data-isodate')).isSame(new Date(), "day") &&
_.get(last_el, 'dataset', {}).join === `"${nick}"`) { _.get(last_el, 'dataset', {}).join === `"${nick}"`) {
let message; let message;
...@@ -1462,7 +1462,8 @@ ...@@ -1462,7 +1462,8 @@
'extra_classes': 'chat-event', 'extra_classes': 'chat-event',
'data': `data-leave="${nick}"` 'data': `data-leave="${nick}"`
} }
if (_.includes(_.get(last_el, 'classList', []), 'chat-info') && if (last_el &&
_.includes(_.get(last_el, 'classList', []), 'chat-info') &&
_.get(last_el, 'dataset', {}).leavejoin === `"${nick}"`) { _.get(last_el, 'dataset', {}).leavejoin === `"${nick}"`) {
last_el.outerHTML = tpl_info(data); last_el.outerHTML = tpl_info(data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment