Commit e49f9747 authored by Bernard Ngandu's avatar Bernard Ngandu Committed by GitHub

#2280 notify changes to client on bookmark-update (#2287)

* notify changes to client on bookmark-update
* update XEP-115 caps verification string
parent a42390c9
...@@ -166,7 +166,7 @@ describe("The Controlbox", function () { ...@@ -166,7 +166,7 @@ describe("The Controlbox", function () {
`<presence xmlns="jabber:client">`+ `<presence xmlns="jabber:client">`+
`<show>dnd</show>`+ `<show>dnd</show>`+
`<priority>0</priority>`+ `<priority>0</priority>`+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`+ `<c hash="sha-1" node="https://conversejs.org" ver="PxXfr6uz8ClMWIga0OB/MhKNH/M=" xmlns="http://jabber.org/protocol/caps"/>`+
`</presence>`); `</presence>`);
const first_child = view.el.querySelector('.xmpp-status span:first-child'); const first_child = view.el.querySelector('.xmpp-status span:first-child');
expect(u.hasClass('online', first_child)).toBe(false); expect(u.hasClass('online', first_child)).toBe(false);
...@@ -196,7 +196,7 @@ describe("The Controlbox", function () { ...@@ -196,7 +196,7 @@ describe("The Controlbox", function () {
`<presence xmlns="jabber:client">`+ `<presence xmlns="jabber:client">`+
`<status>I am happy</status>`+ `<status>I am happy</status>`+
`<priority>0</priority>`+ `<priority>0</priority>`+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`+ `<c hash="sha-1" node="https://conversejs.org" ver="PxXfr6uz8ClMWIga0OB/MhKNH/M=" xmlns="http://jabber.org/protocol/caps"/>`+
`</presence>`); `</presence>`);
const first_child = view.el.querySelector('.xmpp-status span:first-child'); const first_child = view.el.querySelector('.xmpp-status span:first-child');
......
...@@ -5453,7 +5453,7 @@ describe("Groupchats", function () { ...@@ -5453,7 +5453,7 @@ describe("Groupchats", function () {
expect(Strophe.serialize(probe)).toBe( expect(Strophe.serialize(probe)).toBe(
`<presence to="${muc_jid}/ralphm" type="probe" xmlns="jabber:client">`+ `<presence to="${muc_jid}/ralphm" type="probe" xmlns="jabber:client">`+
`<priority>0</priority>`+ `<priority>0</priority>`+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`+ `<c hash="sha-1" node="https://conversejs.org" ver="PxXfr6uz8ClMWIga0OB/MhKNH/M=" xmlns="http://jabber.org/protocol/caps"/>`+
`</presence>`); `</presence>`);
let presence = u.toStanza( let presence = u.toStanza(
...@@ -5485,7 +5485,7 @@ describe("Groupchats", function () { ...@@ -5485,7 +5485,7 @@ describe("Groupchats", function () {
expect(Strophe.serialize(probe)).toBe( expect(Strophe.serialize(probe)).toBe(
`<presence to="${muc_jid}/gonePhising" type="probe" xmlns="jabber:client">`+ `<presence to="${muc_jid}/gonePhising" type="probe" xmlns="jabber:client">`+
`<priority>0</priority>`+ `<priority>0</priority>`+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`+ `<c hash="sha-1" node="https://conversejs.org" ver="PxXfr6uz8ClMWIga0OB/MhKNH/M=" xmlns="http://jabber.org/protocol/caps"/>`+
`</presence>`); `</presence>`);
presence = u.toStanza( presence = u.toStanza(
......
...@@ -37,7 +37,7 @@ describe("A sent presence stanza", function () { ...@@ -37,7 +37,7 @@ describe("A sent presence stanza", function () {
`<presence xmlns="jabber:client">`+ `<presence xmlns="jabber:client">`+
`<status>Hello world</status>`+ `<status>Hello world</status>`+
`<priority>0</priority>`+ `<priority>0</priority>`+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`+ `<c hash="sha-1" node="https://conversejs.org" ver="PxXfr6uz8ClMWIga0OB/MhKNH/M=" xmlns="http://jabber.org/protocol/caps"/>`+
`</presence>` `</presence>`
); );
_converse.priority = 2; _converse.priority = 2;
...@@ -47,7 +47,7 @@ describe("A sent presence stanza", function () { ...@@ -47,7 +47,7 @@ describe("A sent presence stanza", function () {
`<show>away</show>`+ `<show>away</show>`+
`<status>Going jogging</status>`+ `<status>Going jogging</status>`+
`<priority>2</priority>`+ `<priority>2</priority>`+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`+ `<c hash="sha-1" node="https://conversejs.org" ver="PxXfr6uz8ClMWIga0OB/MhKNH/M=" xmlns="http://jabber.org/protocol/caps"/>`+
`</presence>` `</presence>`
); );
...@@ -58,7 +58,7 @@ describe("A sent presence stanza", function () { ...@@ -58,7 +58,7 @@ describe("A sent presence stanza", function () {
`<show>dnd</show>`+ `<show>dnd</show>`+
`<status>Doing taxes</status>`+ `<status>Doing taxes</status>`+
`<priority>0</priority>`+ `<priority>0</priority>`+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`+ `<c hash="sha-1" node="https://conversejs.org" ver="PxXfr6uz8ClMWIga0OB/MhKNH/M=" xmlns="http://jabber.org/protocol/caps"/>`+
`</presence>` `</presence>`
); );
done(); done();
...@@ -88,7 +88,7 @@ describe("A sent presence stanza", function () { ...@@ -88,7 +88,7 @@ describe("A sent presence stanza", function () {
.toBe(`<presence xmlns="jabber:client">`+ .toBe(`<presence xmlns="jabber:client">`+
`<status>My custom status</status>`+ `<status>My custom status</status>`+
`<priority>0</priority>`+ `<priority>0</priority>`+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`+ `<c hash="sha-1" node="https://conversejs.org" ver="PxXfr6uz8ClMWIga0OB/MhKNH/M=" xmlns="http://jabber.org/protocol/caps"/>`+
`</presence>`) `</presence>`)
await u.waitUntil(() => modal.el.getAttribute('aria-hidden') === "true"); await u.waitUntil(() => modal.el.getAttribute('aria-hidden') === "true");
...@@ -105,7 +105,7 @@ describe("A sent presence stanza", function () { ...@@ -105,7 +105,7 @@ describe("A sent presence stanza", function () {
`<show>dnd</show>`+ `<show>dnd</show>`+
`<status>My custom status</status>`+ `<status>My custom status</status>`+
`<priority>0</priority>`+ `<priority>0</priority>`+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`+ `<c hash="sha-1" node="https://conversejs.org" ver="PxXfr6uz8ClMWIga0OB/MhKNH/M=" xmlns="http://jabber.org/protocol/caps"/>`+
`</presence>`) `</presence>`)
done(); done();
})); }));
......
...@@ -14,6 +14,7 @@ import { _converse, api, converse } from "@converse/headless/converse-core"; ...@@ -14,6 +14,7 @@ import { _converse, api, converse } from "@converse/headless/converse-core";
const { Strophe, $iq, sizzle } = converse.env; const { Strophe, $iq, sizzle } = converse.env;
const u = converse.env.utils; const u = converse.env.utils;
Strophe.addNamespace('BOOKMARKS', 'storage:bookmarks');
converse.plugins.add('converse-bookmarks', { converse.plugins.add('converse-bookmarks', {
...@@ -290,6 +291,12 @@ converse.plugins.add('converse-bookmarks', { ...@@ -290,6 +291,12 @@ converse.plugins.add('converse-bookmarks', {
} }
} }
api.listen.on('addClientFeatures', () => {
if (api.settings.get('allow_bookmarks')) {
api.disco.own.features.add(Strophe.NS.BOOKMARKS + '+notify')
}
})
api.listen.on('clearSession', () => { api.listen.on('clearSession', () => {
if (_converse.bookmarks !== undefined) { if (_converse.bookmarks !== undefined) {
_converse.bookmarks.clearStore({'silent': true}); _converse.bookmarks.clearStore({'silent': true});
......
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