chat: Move cookie pref handling to chat init in chat.js

It's unclear why this logic was previously triggered by connection
state changes, but it doesn't make sense for it to be there.
This commit is contained in:
Richard Hansen 2021-12-06 14:32:00 -05:00
parent a5c729af32
commit e0f28cfe86
3 changed files with 12 additions and 21 deletions

View file

@ -293,6 +293,14 @@ exports.chat = (() => {
if (settings.hideChat) this.hide();
if (searchParams.get('alwaysShowChat') === 'true' && !settings.hideChat) this.stickToScreen();
if (searchParams.get('chatAndUsers') === 'true') this.chatAndUsers();
const chatVisCookie = !!padcookie.getPref('chatAlwaysVisible');
if (chatVisCookie) this.stickToScreen(true);
$('#options-stickychat').prop('checked', chatVisCookie);
const chatAUVisCookie = !!padcookie.getPref('chatAndUsersVisible');
if (chatAUVisCookie) this.chatAndUsers(true);
$('#options-chatandusers').prop('checked', chatAUVisCookie);
},
};
})();