Merge branch 'release/sxc-149' into feature/port-test

This commit is contained in:
Jean-Baptiste Pasquier 2020-09-17 12:34:15 +02:00
commit 6f143b0ebb
2 changed files with 8 additions and 3 deletions

View File

@ -31,7 +31,7 @@ if endpoints.dashboards || (endpoints.get && endpoints.get.dashboards)
//- script(type="module" src="/lib/solid-dashboard/dist/index.js" defer)
if endpoints.users || (endpoints.get && endpoints.get.users)
script(type="module" src="https://unpkg.com/@startinblox/component-chat@0.8" defer)
script(type="module" src="https://unpkg.com/@startinblox/component-chat@1.0" defer)
//- script(type="module" src="/lib/solid-xmpp-chat/dist/index.js" defer)
script(src="/scripts/index.js" defer)

View File

@ -1,7 +1,7 @@
document.addEventListener("DOMContentLoaded", function (event) {
window.addEventListener('newMessage', event => {
let jid = event.detail.jid;
Array.from(document.querySelectorAll('[data-jabberID="'+jid+'"]')).forEach(el => {
Array.from(document.querySelectorAll('[data-jabberID="' + jid + '"]')).forEach(el => {
el.parentElement.parentElement.classList.add('unread');
});
});
@ -9,7 +9,12 @@ document.addEventListener("DOMContentLoaded", function (event) {
window.addEventListener('read', (event) => {
if (event.detail && event.detail.resource && event.detail.resource['@id']) {
const badge = document.querySelector(`solid-badge[data-src="${event.detail.resource['@id']}"]`);
if (badge) badge.parentElement.parentElement.classList.remove('unread');
if (badge) {
badge.parentElement.parentElement.classList.remove('unread');
const project = badge.parentElement.parentElement.querySelector('.unread');
if (project) project.classList.remove('unread');
}
}
});
});