conversejs / converse.js

Web-based XMPP/Jabber chat client written in JavaScript
http://conversejs.org
Mozilla Public License 2.0
3.07k stars 767 forks source link

Unable to open the newly created room after user login success #3297

Open udaysv opened 9 months ago

udaysv commented 9 months ago

Describe the bug

After successfully logging into the app, the admin user(Other user) creates a new room and adds the logged-in user as a participant to this room. Subsequently, when this logged-in user attempts to open a room using the JID and password, they encounter difficulty and are unable to access the room UI.

let converseSettingsObj = {
        bosh_service_url: boshUrl,

        credentials_url: {
            jid: getUserJID(),
            password: getToken()
        },
        jid: getUserJID(),
        password: getToken(),
        auto_login: true,
        authentication: "login",
        keepalive: true,
        allow_logout: true,
        auto_list_rooms: false,
        theme: "concord",
        auto_reconnect: true,
        play_sounds: true,
        sounds_path: `/sounds/`,
        notification_icon: '/logo/',
        view_mode: "embedded",
        singleton: false,
        show_tab_notifications: true,
        discover_connection_methods: false,
        auto_register_muc_nickname: true,
        notify_all_room_messages: true,
        auto_subscribe: true,
        allow_contact_requests: true,
        locked_domain: xmppDomain,
        muc_domain: xmppMUCDomain,
        allowed_image_domains: xmppImageDomains,
        allowed_audio_domains: xmppAudioDomains,
        allowed_video_domains: xmppVideoDomains,
        locked_muc_domain: true,
        show_controlbox_by_default: false,
        clear_cache_on_logout: true,
        allow_user_trust_override: "off",
        allow_message_styling: true,
        stanza_timeout: 90000,
        csi_waiting_time: 3,
        auto_away: 3,
        auto_xa: 6,
        show_message_avatar: false,
        time_format: "hh:mm A",
        allow_non_roster_messaging: true,
        idle_presence_timeout: 900,
        reuse_scram_keys: true,
        visible_toolbar_buttons: {
            call: false,
            spoiler: false,
            emoji: true,
            toggle_occupants: false,
        },
        whitelisted_plugins: ["main_plugin"],
        blacklisted_plugins: ['converse-vcard', 'converse-notification'],

    }
const roomJID = `${data.room_id}@${xmppMUCDomain}`;
const nick = "xxxx";
const password = "xxxxx";
_converse.api.rooms.open(roomJID,
    {
        nick: nick,
        id: roomJID,
        jid: roomJID, 
        password: password,
    }, true);

To Reproduce Steps to reproduce the behavior:

  1. Create a React JS project and add CDN Links of converse js 10.1.4.
  2. Create a login for the user and after login success initialize the converse window object.
  3. After Converse JS is ready. an Admin user(Other user) will add this user to the room.
  4. If this login user tries to open this circle. The room is not opening.

Environment (please complete the following information):

Additional context When I tried to get the room object.

let model = await _converse.api.chatboxes.get(roomJID);

It is returning null for that room.

jcbrand commented 9 months ago

Thanks for the bug report.

they encounter difficulty and are unable to access the room UI

This is unfortunately too vague to know what's going on. Please check the browser's developer console for errors.

It's also a good idea to set loglevel to 'debug' in your converseSettingsObj so that you can see the XML stanza traffic when trying to enter the MUC.

udaysv commented 9 months ago

@jcbrand I have kept logs. But there is no errors in browser console. It is opening previous room UI.

My Observation: If I call rooms.open for new room. It is directly calling with previously opened room jid instead of new room

chat room view is initilizing with previously opened jid.

converse.api.listen.on('chatRoomViewInitialized', (view: any) => {
             console.log("custom plugin chatRoomViewInitialized", "fire", view);
 });
log2 log_1 conversejs_add