converse.js
converse.js copied to clipboard
MUC: Affiliation and role change immediately to "member" when joining a channel as owner/admin
Describe the bug When I join a channel that I am an owner of, my affiliation and role immediately change to "member" and I lose owner functionality. This is my converse setup
converse.initialize({
show_controlbox_by_default: true,
bosh_service_url: "http://localhost:7070/http-bind/",
});
As soon as I join a channel I own I get these two messages
X is no longer an owner of this groupchat
X is now a member of this groupchat
When I curl openfire occupants of the room I get my role and affiliation correctly
{"occupants":[{"jid":"[email protected]/lucas","role":"moderator","affiliation":"owner"}]}
When I run
_converse.api.listen.on("chatRoomInitialized", (model) => {
console.log(model.getAffiliationList("owner"))
}
It shows the user as an owner in the returned array.
To Reproduce Join a channel that I am an owner/admin of, I get the change affiliation message every time I reload the page too
Expected behavior To be an owner and have access to moderator tools
Screenshots https://imgur.com/l3159T5
Environment (please complete the following information):
- Desktop
- Browser : Chrome/Firefox
- Converse.js version: The issues starts at version 5.0.0, version 4 doesn't change role/affiliation on load/refresh
Additional context N/A
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Please set loglevel to 'debug', enable verbose logging in your console browser and then paste in this ticket the stanza traffic that occurs in your browser console when you enter the MUC.
I think what's happening is that Converse mistakes a particular stanza as an affiliation change, but I don't know what that stanza looks like.
2021-09-09T11:58:27.009Z DEBUG: <body rid="3391435517" sid="5z8o9ayhof"><iq from="lucas@localhost/converse.js-49734210" to="[email protected]" type="get" id="b166f1d3-0b58-4b63-8b65-867e50e9c0af:sendIQ"><query/></iq></body>
2021-09-09T11:58:27.031Z DEBUG: <body xmlns="http://jabber.org/protocol/httpbind" ack="3391435517"><iq type="result" id="b166f1d3-0b58-4b63-8b65-867e50e9c0af:sendIQ" from="[email protected]" to="lucas@localhost/converse.js-49734210" xmlns="jabber:client"><query xmlns="http://jabber.org/protocol/disco#info"><identity category="conference" name="Lucas Hernandez" type="text"/><feature var="http://jabber.org/protocol/muc"/><feature var="muc_public"/><feature var="muc_open"/><feature var="muc_moderated"/><feature var="muc_semianonymous"/><feature var="muc_unsecured"/><feature var="muc_persistent"/><feature var="http://jabber.org/protocol/muc#self-ping-optimization"/><feature var="urn:xmpp:sid:0"/><feature var="http://jabber.org/protocol/disco#info"/><feature var="urn:xmpp:bookmarks-conversion:0"/><x xmlns="jabber:x:data" type="result"><field var="FORM_TYPE" type="hidden"><value>http://jabber.org/protocol/muc#roominfo</value></field><field var="muc#roominfo_description" label="Description"><value>Eyon Chatroom for: Lucas Hernandez</value></field><field var="muc#roominfo_subject" label="Subject"><value>Eyon Chatroom for: Lucas Hernandez</value></field><field var="muc#roominfo_occupants" label="Number of occupants"><value>0</value></field><field var="x-muc#roominfo_creationdate" label="Creation date"><value>2021-09-09T11:50:07.684Z</value></field></x></query></iq></body>
2021-09-09T11:58:27.151Z DEBUG: <body rid="3391435518" sid="5z8o9ayhof"><presence from="lucas@localhost/converse.js-49734210" to="[email protected]/lucas"><x><history/></x></presence></body>
2021-09-09T11:58:27.205Z DEBUG: <body xmlns="http://jabber.org/protocol/httpbind" ack="3391435518"><presence from="[email protected]/lucas" to="lucas@localhost/converse.js-49734210" xmlns="jabber:client"><x xmlns="http://jabber.org/protocol/muc#user"><item jid="lucas@localhost/converse.js-49734210" affiliation="owner" role="moderator"/><status code="110"/></x></presence></body>
2021-09-09T11:58:27.312Z DEBUG: <body rid="3391435519" sid="5z8o9ayhof"><iq to="[email protected]" type="get" id="5f3f499e-63c4-45c4-87f8-390a4498e1b7:sendIQ"><query><item affiliation="member"/></query></iq><iq to="[email protected]" type="get" id="cb6f8f1b-89c8-4fda-ad04-71b1002b5d94:sendIQ"><query><item affiliation="admin"/></query></iq><iq to="[email protected]" type="get" id="7ce5c5b6-9321-482d-9838-3ca4300eb2ae:sendIQ"><query><item affiliation="owner"/></query></iq></body>
2021-09-09T11:58:27.326Z DEBUG: <body xmlns="http://jabber.org/protocol/httpbind" ack="3391435518"><message from="[email protected]/lucas" id="9b4a5108-d20c-44b5-b788-d5242591287b" to="lucas@localhost/converse.js-49734210" type="groupchat" xmlns="jabber:client"><body>test</body><active xmlns="http://jabber.org/protocol/chatstates"/><origin-id xmlns="urn:xmpp:sid:0" id="9b4a5108-d20c-44b5-b788-d5242591287b"/><stanza-id xmlns="urn:xmpp:sid:0" id="9b4a5108-d20c-44b5-b788-d5242591287b" by="[email protected]"/><delay xmlns="urn:xmpp:delay" stamp="2021-09-09T11:50:26.052Z" from="[email protected]/lucas"/></message><message from="[email protected]" type="groupchat" id="f618ce50-77d8-48cd-a54c-f01e8b1c4e2d" to="lucas@localhost/converse.js-49734210" xmlns="jabber:client"><subject/></message></body>
2021-09-09T11:58:27.429Z DEBUG: <body xmlns="http://jabber.org/protocol/httpbind" ack="3391435519"><iq type="result" id="5f3f499e-63c4-45c4-87f8-390a4498e1b7:sendIQ" from="[email protected]" to="lucas@localhost/converse.js-49734210" xmlns="jabber:client"><query xmlns="http://jabber.org/protocol/muc#admin"><item affiliation="member" jid="eyonbot@localhost"/><item affiliation="member" jid="eyonbot@localhost"/><item affiliation="member" jid="hatim@localhost"/><item affiliation="member" jid="joel@localhost"/><item affiliation="member" jid="lucas@localhost" role="moderator" nick="lucas"/><item affiliation="member" jid="martin@localhost"/><item affiliation="member" jid="bryan@localhost"/><item affiliation="member" jid="randy@localhost"/></query></iq><iq type="result" id="cb6f8f1b-89c8-4fda-ad04-71b1002b5d94:sendIQ" from="[email protected]" to="lucas@localhost/converse.js-49734210" xmlns="jabber:client"><query xmlns="http://jabber.org/protocol/muc#admin"/></iq><iq type="result" id="7ce5c5b6-9321-482d-9838-3ca4300eb2ae:sendIQ" from="[email protected]" to="lucas@localhost/converse.js-49734210" xmlns="jabber:client"><query xmlns="http://jabber.org/protocol/muc#admin"><item affiliation="owner" jid="lucas@localhost" role="moderator" nick="lucas"/></query></iq></body>
This is the information I get when I join lucas's room as lucas.
Thanks.
Converse makes 3 IQ stanza queries to get results for 3 different affiliations, member, owner and admin.
If we look at the responses to two of these queries, we see that Openfire claims that your user is both an owner and a member.
<iq type="result" id="5f3f499e-63c4-45c4-87f8-390a4498e1b7:sendIQ" from="[email protected]" to="lucas@localhost/converse.js-49734210" xmlns="jabber:client">
<query xmlns="http://jabber.org/protocol/muc#admin">
...
<item affiliation="member" jid="lucas@localhost" role="moderator" nick="lucas"/>
...
</iq>
<iq type="result" id="7ce5c5b6-9321-482d-9838-3ca4300eb2ae:sendIQ" from="[email protected]" to="lucas@localhost/converse.js-49734210" xmlns="jabber:client">
<query xmlns="http://jabber.org/protocol/muc#admin">
<item affiliation="owner" jid="lucas@localhost" role="moderator" nick="lucas"/>
</query>
</iq>
I'm pretty sure this is not correct and that a user can have only one affiliation at a time, not two, and so this looks to me like an Openfire bug.
As a potential workaround, you can set the muc_fetch_members setting to only fetch ['owner']. I think then your user will show up as an owner. Can you please double-check whether this is correct?
I tried it with muc_fetch_members set to ["owner"] and when I joined I was an owner, but not a moderator.
I had the configure option but clicking on moderate gave me a
Forbidden: you do not have the necessary role in order to do that whereas configure worked fine
These are the presence stanzas when I joined the room
2021-09-10T06:58:48.476Z DEBUG: <body xmlns="http://jabber.org/protocol/httpbind" ack="2186034352"><presence from="[email protected]/lucas" to="lucas@localhost/converse.js-36742786" xmlns="jabber:client"><x xmlns="http://jabber.org/protocol/muc#user"><item jid="lucas@localhost/converse.js-36742786" affiliation="owner" role="moderator"/><status code="110"/></x></presence></body>
2021-09-10T06:58:48.476Z DEBUG: <body xmlns="http://jabber.org/protocol/httpbind" ack="2186034352"><presence from="[email protected]/lucas" to="lucas@localhost/converse.js-36742786" xmlns="jabber:client"><x xmlns="http://jabber.org/protocol/muc#user"><item jid="lucas@localhost/converse.js-36742786" affiliation="owner" role="moderator"/><status code="110"/></x></presence></body>
Related? https://github.com/conversejs/converse.js/issues/1426