Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlbox disappears on logout for an untrusted device #3268

Open
chrzaszcz opened this issue Sep 6, 2023 · 1 comment
Open

Controlbox disappears on logout for an untrusted device #3268

chrzaszcz opened this issue Sep 6, 2023 · 1 comment
Milestone

Comments

@chrzaszcz
Copy link

chrzaszcz commented Sep 6, 2023

Describe the bug
When the user unchecks "This is a trusted device", the storage is cleaned up on logout. However, the whole controlbox is lost in the process, making the whole Web UI empty, i.e. the whole login screen disappears.

To Reproduce
Steps to reproduce the behavior:

  1. Uncheck "This is a trusted device"
  2. Logout
  3. UI is empty

Expected behavior
Login screen should appear again.

Screenshots
Completely blank UI, so no screenshot needed.

Environment (please complete the following information):

  • Desktop
  • Latest Firefox.
  • Converse.js 10.1.5

Additional context
I spent some time debugging this, and I found that commenting out the following lines resolves the issue:

export async function onClearSession () {
    if (shouldClearCache()) {
        await Promise.all(
            _converse.chatboxes.map(c => c.messages && c.messages.clearStore({ 'silent': true }))
        );
        //const filter = o => o.get('type') !== _converse.CONTROLBOX_TYPE;
        //_converse.chatboxes.clearStore({ 'silent': true }, filter);
    }
}

It looks like the clearStore function in skeletor is supposed to take the filter into consideration, and only clean up the boxes that are not filtered out. However, it calls this._reset() which deletes all models, making the controlbox disappear when the UI is later updated.

Is my reasoning correct?

My configuration:

converse.initialize({
            dark_theme: "default",
            allow_dragresize: true,
            view_mode: 'embedded',
            websocket_url: 'ws://m:5280/ws-xmpp',
            discover_connection_methods: false,
            loglevel: "debug",
            show_controlbox_by_default: true,
            allow_user_trust_override: true,
            allow_registration: false,
            auto_reconnect: true
        });
@jcbrand
Copy link
Member

jcbrand commented Sep 29, 2023

Is my reasoning correct?

Yes I think it's correct. I think the fix is to update clearStore in Skeletor to pass the filtered out model(s) to this.reset() so that those models are kept.

See here: https://github.com/conversejs/skeletor/blob/69b49b4cfcb2db323ac0bed5472ebb8cd714b6c5/src/collection.js#L277

@jcbrand jcbrand modified the milestone: 11.0.0 Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants