Bug: Who is chatting userlist refuses to stay open.

Support area for phpBB's mChat extension
Post Reply
Bgagger
Donor
Posts: 63
Joined: 28 Nov 2018, 15:57

Bug: Who is chatting userlist refuses to stay open.

#1

Post by Bgagger » 16 Feb 2020, 01:35

We just updated our boardware from 3.2.8 to 3.3.0 and have discovered a bug in mChat that appears to be incompatible with 3.3.0

The 'Who is chatting' userlist beneath the mChat window that displays a list of users that are chatting closes (dissapears) every time the list updates (every x seconds).

It opens and closes normally when clicking the 'x users are chatting' link. But if open it will always close again on each update.

This is the element in question (when open):
<div id="mchat-userlist" class="hidden" style="display: block;"></div>
Generated from the file mchat/styles/prosilver/template/mchat_whois.html

After each update it reverts to:
<div id="mchat-userlist" class="hidden"></div>
And gets the following CSS behaviour:
.hidden {
display: none;
}
from [root]/styles/prosilver/theme/utilities.css
or the equivalent in prosilver based styles.


As a temporary fix, I have added:
#mchat-userlist { /* Bg custom */
display: block !important;
}
at the bottom of mchat/styles/prosilver/theme/mchat.css
And changed:
<a href="#" data-mchat-action="toggle" data-mchat-element="userlist">{{ MCHAT_USERS_TOTAL }}</a>
to:
<a href="#" data-mchat-action="" data-mchat-element="userlist">{{ MCHAT_USERS_TOTAL }}</a>

This makes the user list always display and disables manually closing it.
As it is preferable that is is always shown, then constantly closing when you want to see it.

User avatar
WeitraLord
Donor
Posts: 1
Joined: 21 May 2017, 19:04
Contact:

Re: Bug: Who is chatting userlist refuses to stay open.

#2

Post by WeitraLord » 16 Feb 2020, 10:28

I just tested these changes and the Who's Online ad is now working. Thanks for that ;-)

User avatar
kasimi
mChat developer
Posts: 1030
Joined: 06 Oct 2016, 09:56
Location: Germany
Contact:

Re: Bug: Who is chatting userlist refuses to stay open.

#3

Post by kasimi » 16 Feb 2020, 11:28

You might want to try this. It keeps the original behavior, i.e. it keeps the username list closed by default, and correctly remembers the state when refreshing it.
  • Open ext/dmzx/mchat/styles/all/template/javascript/mchat.js
  • Find, around line 400:

    Code: Select all

    if (mChat.storage.get('show_userlist')) {
        $userlist.show();
    }
    mChat.cached('whois').replaceWith($whois);
    mChat.cache.whois = $whois;
    mChat.cache.userlist = $userlist;
    
  • Replace with:

    Code: Select all

    mChat.cached('whois').replaceWith($whois);
    mChat.cache.whois = $whois;
    mChat.cache.userlist = $userlist;
    if (mChat.storage.get('show_userlist')) {
    	$userlist.show();
    }
    

Bgagger
Donor
Posts: 63
Joined: 28 Nov 2018, 15:57

Re: Bug: Who is chatting userlist refuses to stay open.

#4

Post by Bgagger » 16 Feb 2020, 22:31

Thank you for the advice, this patch appears to be working.
Would there be any way of reversing the start state though, so that the list is open by default?

User avatar
kasimi
mChat developer
Posts: 1030
Joined: 06 Oct 2016, 09:56
Location: Germany
Contact:

Re: Bug: Who is chatting userlist refuses to stay open.

#5

Post by kasimi » 16 Feb 2020, 22:34

Sure, try this:
  • Open ext/dmzx/mchat/styles/prosilver/template/mchat_whois.html
  • Find:

    Code: Select all

    <div id="mchat-userlist" class="hidden">{{ MCHAT_USERS_LIST }}</div>
    
  • Replace with:

    Code: Select all

    <div id="mchat-userlist">{{ MCHAT_USERS_LIST }}</div>
    
And thanks for confirming the above fix is working. :+1:

Bgagger
Donor
Posts: 63
Joined: 28 Nov 2018, 15:57

Re: Bug: Who is chatting userlist refuses to stay open.

#6

Post by Bgagger » 17 Feb 2020, 15:55

kasimi wrote:
16 Feb 2020, 22:34
Sure, try this:
  • Open ext/dmzx/mchat/styles/prosilver/template/mchat_whois.html
  • Find:

    Code: Select all

    <div id="mchat-userlist" class="hidden">{{ MCHAT_USERS_LIST }}</div>
    
  • Replace with:

    Code: Select all

    <div id="mchat-userlist">{{ MCHAT_USERS_LIST }}</div>
    
And thanks for confirming the above fix is working. :+1:
I've tried that now and it works in Chrome and Opera, but not Firefox, for some reason. When entering chat with FF the list blinks open for a second, then closes again.
Having:

Code: Select all

display: none;
As an element inline property. Not sure how it gets that.
That's a minor issue though. Thanx again for the patches!

User avatar
kasimi
mChat developer
Posts: 1030
Joined: 06 Oct 2016, 09:56
Location: Germany
Contact:

Re: Bug: Who is chatting userlist refuses to stay open.

#7

Post by kasimi » 17 Feb 2020, 21:59

It's just a coincidence that it worked in some browsers while in others it didn't. The code that adjusts the visibility on page load according to the previous state is a bit squeamish. Let's make it more robust:
  • Open ext/dmzx/mchat/styles/all/template/javascript/mchat.js
  • Find, around line 780:

    Code: Select all

    if (mChat.storage.get('show_' + elem)) {
        $('.mchat-button-' + elem).addClass('mchat-button-is-down');
        mChat.cached(elem).toggle();
    }
    
  • Replace with:

    Code: Select all

    var isVisible = mChat.storage.get('show_' + elem) === 'yes';
    $('.mchat-button-' + elem).toggleClass('mchat-button-is-down', isVisible);
    mChat.cached(elem).toggle(isVisible);
    
After applying this fix, the edit in my previous post should work fine.

Bgagger
Donor
Posts: 63
Joined: 28 Nov 2018, 15:57

Re: Bug: Who is chatting userlist refuses to stay open.

#8

Post by Bgagger » 21 Feb 2020, 21:55

kasimi wrote:
17 Feb 2020, 21:59
After applying this fix, the edit in my previous post should work fine.
This almost works.
It opens as default just fine and remains open.
I can also manually close and open it just fine.
But if closed (manually), it opens by itself again on the next update.

Which is a lot better then before the original problem. I can live with this, most of our users want the list open all the time anyway.
It might annoy someone though, possibly some mobile users I guess. Though the list doesn't really take up much space.

Added in 8 minutes 49 seconds:
...may have spoken too soon. It seems it is open, as it should if i leave the page and open it again. But if I log out and log back in, it's closed from the start.
It's still getting an inline display: none; from out of nowhere when entering the chat page the first time. Even if the 'hidden' class is definitely not there (checking in the browser dev tools).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest