Skip to content

Commit b8c5137

Browse files
committed
Explicity set history to zero
If it's omitted, messages are returned.
1 parent 0bb2374 commit b8c5137

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"build:website-min-css": "npm run build:website-css && npx clean-css-cli dist/website.css > dist/website.min.css",
5656
"cdn": "ASSET_PATH=https://cdn.conversejs.org/dist/ npm run build",
5757
"clean": "rm -rf node_modules dist *.zip src/headless/dist src/headless/node_modules",
58-
"dev": "DROP_DEBUGGER=false rspack build --config rspack/rspack.build.js --mode=development",
58+
"dev": "DROP_DEBUGGER=false npm run dev:headless && rspack build --config rspack/rspack.build.cjs.js --mode=development",
5959
"dev:headless": "DROP_DEBUGGER=false rspack build --config rspack/rspack.headless.js --mode=development",
6060
"devserver": "npm run dev:headless && npx rspack serve --config rspack/rspack.serve.js",
6161
"lint": "eslint src/**/*.js",
@@ -69,7 +69,7 @@
6969
"types:check": "tsc --noEmit",
7070
"watch": "concurrently \"npm run watch:headless\" \"npm run watch:main\"",
7171
"watch:headless": "DROP_DEBUGGER=false rspack --watch --config rspack/rspack.headless.js --mode=development",
72-
"watch:main": "DROP_DEBUGGER=false rspack --watch --config rspack/rspack.build.js --mode=development"
72+
"watch:main": "DROP_DEBUGGER=false rspack --watch --config rspack/rspack.build.cjs.js --mode=development"
7373
},
7474
"repository": {
7575
"type": "git",

src/headless/plugins/muc/muc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class MUC extends ModelWithVCard(ModelWithMessages(ColorAwareModel(ChatBoxBase))
237237
from="${api.connection.get().jid}"
238238
to="${this.getRoomJIDAndNick()}">
239239
<x xmlns="${Strophe.NS.MUC}">
240-
${maxstanzas ? stx`<history maxstanzas="${maxstanzas}"/>` : ''}
240+
<history maxstanzas="${maxstanzas || 0}"/>
241241
${password ? stx`<password>${password}</password>` : ''}
242242
</x>
243243
${PRES_SHOW_VALUES.includes(show) ? stx`<show>${show}</show>` : ''}

src/headless/plugins/muc/tests/muc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe("Groupchats", function () {
5757
let pres = await u.waitUntil(() => sent_stanzas.filter(s => s.nodeName === 'presence').pop());
5858
expect(pres).toEqualStanza(stx`
5959
<presence from="${_converse.jid}" id="${pres.getAttribute('id')}" to="${muc_jid}/romeo" xmlns="jabber:client">
60-
<x xmlns="http://jabber.org/protocol/muc"/>
60+
<x xmlns="http://jabber.org/protocol/muc"><history maxstanzas="0"/></x>
6161
<show>away</show>
6262
<c hash="sha-1" node="https://conversejs.org" ver="t7NrIuCRhg80cJKAq33v3LKogjI=" xmlns="http://jabber.org/protocol/caps"/>
6363
</presence>`);
@@ -86,7 +86,7 @@ describe("Groupchats", function () {
8686
pres = await u.waitUntil(() => sent_stanzas.filter(s => s.nodeName === 'presence').pop());
8787
expect(pres).toEqualStanza(stx`
8888
<presence from="${_converse.jid}" id="${pres.getAttribute('id')}" to="${muc2_jid}/romeo" xmlns="jabber:client">
89-
<x xmlns="http://jabber.org/protocol/muc"/>
89+
<x xmlns="http://jabber.org/protocol/muc"><history maxstanzas="0"/></x>
9090
<show>dnd</show>
9191
<status>Do not disturb</status>
9292
<c hash="sha-1" node="https://conversejs.org" ver="t7NrIuCRhg80cJKAq33v3LKogjI=" xmlns="http://jabber.org/protocol/caps"/>
@@ -144,7 +144,7 @@ describe("Groupchats", function () {
144144
() => sent_stanzas.slice(index).filter(s => s.nodeName === 'presence').pop());
145145
expect(pres).toEqualStanza(stx`
146146
<presence from="${_converse.jid}" id="${pres.getAttribute('id')}" to="coven@chat.shakespeare.lit/romeo" xmlns="jabber:client">
147-
<x xmlns="http://jabber.org/protocol/muc"/>
147+
<x xmlns="http://jabber.org/protocol/muc"><history maxstanzas="0"/></x>
148148
<c hash="sha-1" node="https://conversejs.org" ver="t7NrIuCRhg80cJKAq33v3LKogjI=" xmlns="http://jabber.org/protocol/caps"/>
149149
</presence>`);
150150
}));

src/headless/plugins/muc/tests/presence.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('MUC presence history element', function () {
4040
);
4141
expect(sent_stanza).toEqualStanza(stx`
4242
<presence to="${muc2_jid}/${nick}" xmlns="jabber:client" id="${sent_stanza.getAttribute('id')}" from="${jid}">
43-
<x xmlns="http://jabber.org/protocol/muc"/>
43+
<x xmlns="http://jabber.org/protocol/muc"><history maxstanzas="0"/></x>
4444
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://conversejs.org" ver="t7NrIuCRhg80cJKAq33v3LKogjI="/>
4545
</presence>`);
4646
})

src/headless/types/shared/constants.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const BOSH_WAIT: 59;
2-
export const VERSION_NAME: "v11.0.1";
2+
export const VERSION_NAME: "v12.0.0";
33
export const PRES_SHOW_VALUES: string[];
44
export const PRES_TYPE_VALUES: string[];
55
export namespace STATUS_WEIGHTS {

src/plugins/bookmark-views/tests/bookmarks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ describe("Bookmarks", function () {
272272
id="${sent_stanza.getAttribute('id')}"
273273
to="${autojoin_muc}/JC">
274274
<x xmlns="http://jabber.org/protocol/muc">
275+
<history maxstanzas="0"/>
275276
<password>secret</password>
276277
</x>
277278
<c xmlns="http://jabber.org/protocol/caps"

src/plugins/muc-views/tests/nickname.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ describe("A MUC", function () {
334334
to="romeo@montague.lit/pda"
335335
type="error"
336336
xmlns="jabber:client">
337-
<x xmlns="http://jabber.org/protocol/muc"/>
337+
<x xmlns="http://jabber.org/protocol/muc"><history maxstanzas="0"/></x>
338338
<error by="${muc_jid}" type="cancel">
339339
<conflict xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
340340
</error>
@@ -387,7 +387,7 @@ describe("A MUC", function () {
387387
from="${connection.jid}"
388388
to="${muc_jid}/romeo-2"
389389
xmlns="jabber:client">
390-
<x xmlns="http://jabber.org/protocol/muc"/>
390+
<x xmlns="http://jabber.org/protocol/muc"><history maxstanzas="0"/></x>
391391
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://conversejs.org"
392392
ver="qgxN8hmrdSa2/4/7PUoM9bPFN2s="/>
393393
</presence>`);
@@ -402,7 +402,7 @@ describe("A MUC", function () {
402402
id="${u.getUniqueId()}"
403403
to="romeo@montague.lit/pda"
404404
type="error">
405-
<x xmlns="http://jabber.org/protocol/muc"/>
405+
<x xmlns="http://jabber.org/protocol/muc"><history maxstanzas="0"/></x>
406406
<error by="${muc_jid}" type="cancel">
407407
<conflict xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
408408
</error>
@@ -417,7 +417,7 @@ describe("A MUC", function () {
417417
from="${connection.jid}"
418418
to="${muc_jid}/romeo-3"
419419
xmlns="jabber:client">
420-
<x xmlns="http://jabber.org/protocol/muc"/>
420+
<x xmlns="http://jabber.org/protocol/muc"><history maxstanzas="0"/></x>
421421
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://conversejs.org"
422422
ver="qgxN8hmrdSa2/4/7PUoM9bPFN2s="/>
423423
</presence>`);
@@ -447,7 +447,7 @@ describe("A MUC", function () {
447447
from="${connection.jid}"
448448
to="${muc_jid}/romeo-4"
449449
xmlns="jabber:client">
450-
<x xmlns="http://jabber.org/protocol/muc"/>
450+
<x xmlns="http://jabber.org/protocol/muc"><history maxstanzas="0"/></x>
451451
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://conversejs.org"
452452
ver="qgxN8hmrdSa2/4/7PUoM9bPFN2s="/>
453453
</presence>`);

0 commit comments

Comments
 (0)