...
 
Commits (4)
import 'https://unpkg.com/converse.js@5.0/dist/converse.min.js';
import 'https://unpkg.com/converse.js@5.0/dist/emojis.js';
import { Helpers, store } from 'https://unpkg.com/@startinblox/core@0.8';
import { Sib } from "https://unpkg.com/@startinblox/core@0.8/dist/libs/Sib.js";
import { StoreMixin } from 'https://unpkg.com/@startinblox/core@0.8/dist/mixins/storeMixin.js';
import { Helpers, store } from 'https://unpkg.com/@startinblox/core@0.9';
import { Sib } from "https://unpkg.com/@startinblox/core@beta/dist/libs/Sib.js";
import { StoreMixin } from 'https://unpkg.com/@startinblox/core@beta/dist/mixins/storeMixin.js';
Helpers.importCSS('https://unpkg.com/converse.js@4.2/css/fonts.css');
......@@ -61,20 +61,23 @@ export const SibChat = {
async populate() {
if(typeof converse_sib !== 'undefined') {
await converse_sib.loaded_deferred;
if (this.resource.jabberRoom) {
this.jid = this.resource['foaf:jabberID'];
if (await this.resource.jabberRoom) {
this.jid = (await this.resource['foaf:jabberID']).toString();
} else {
this.jid = (await store.get(this.resource.chatProfile['@id']))['foaf:jabberID'];
await store.initGraph(this.resource['@id'], {"jabberID": "foaf:jabberID"});
this.jid = (await (store.get(this.resource['@id'])['chatProfile.jabberID'])).toString();
}
await converse_sib.connected_deferred
converse_sib.service.plugins.sibChat.changeChat(
this.jid,
this.resource.jabberRoom,
await this.resource.jabberRoom,
this.element.shadowRoot,
);
window.dispatchEvent(new CustomEvent('read', {
detail: {
resource: this.resource
resource: {
"@id": this.resource
}
}
}));
} // Else, not logged in, on chat change
......@@ -171,15 +174,16 @@ export const SibChat = {
});
let user = await document.querySelector('sib-auth').getUser();
user = await store.get(user);
const jabberID = (await store.get(user.chatProfile['@id']))['foaf:jabberID'];
await store.initGraph(user['@id'], {"jabberID": "foaf:jabberID"});
const jabberID = (await (store.get(user['@id'])['chatProfile.jabberID'])).toString();
if(this.resource) {
if (this.resource.jabberRoom) {
this.jid = this.resource['foaf:jabberID'];
if (await this.resource.jabberRoom) {
this.jid = (await this.resource['foaf:jabberID']).toString();
} else {
this.jid = (await store.get(this.resource.chatProfile['@id']))['foaf:jabberID'];
await store.initGraph(this.resource['@id'], {"jabberID": "foaf:jabberID"});
this.jid = (await (store.get(this.resource['@id'])['chatProfile.jabberID'])).toString();
}
} else {
this.jid = jabberID;
......