diff --git a/sib-chat.js b/sib-chat.js index cf5a26049d01154a0e018300e2687dd3f8dbf919..fe1f7c899f298f473a6204f4e1c690ead856068c 100644 --- a/sib-chat.js +++ b/sib-chat.js @@ -5,6 +5,7 @@ import { Sib } from "https://unpkg.com/@startinblox/core@0.9/dist/libs/Sib.js"; import { StoreMixin } from 'https://unpkg.com/@startinblox/core@0.9/dist/mixins/storeMixin.js'; Helpers.importCSS('https://unpkg.com/converse.js@4.2/css/fonts.css'); +const jabberIDContext = { "foaf": 'http://xmlns.com/foaf/0.1/', "chatProfile": "http://happy-dev.fr/owl/#chatProfile", "jabberID": "foaf:jabberID" }; class Deferred { constructor() { @@ -64,8 +65,8 @@ export const SibChat = { if (await this.resource.jabberRoom) { this.jid = (await this.resource['foaf:jabberID']).toString(); } else { - await store.initGraph(this.resource['@id'], {"jabberID": "foaf:jabberID"}); - this.jid = (await (store.get(this.resource['@id'])['chatProfile.jabberID'])).toString(); + await store.initGraph(this.resource['@id'], jabberIDContext); + this.jid = await (store.get(this.resource['@id'])['chatProfile.jabberID']); } await converse_sib.connected_deferred converse_sib.service.plugins.sibChat.changeChat( @@ -174,15 +175,14 @@ export const SibChat = { }); let user = await document.querySelector('sib-auth').getUser(); - await store.initGraph(user['@id'], {"jabberID": "foaf:jabberID"}); - const jabberID = (await (store.get(user['@id'])['chatProfile.jabberID'])).toString(); - + await store.initGraph(user['@id'], jabberIDContext); + const jabberID = await (store.get(user['@id'])['chatProfile.jabberID']); if(this.resource) { if (await this.resource.jabberRoom) { this.jid = (await this.resource['foaf:jabberID']).toString(); } else { - await store.initGraph(this.resource['@id'], {"jabberID": "foaf:jabberID"}); + await store.initGraph(this.resource['@id'], jabberIDContext); this.jid = (await (store.get(this.resource['@id'])['chatProfile.jabberID'])).toString(); } } else {