mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-06-18 04:04:50 -04:00
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:
parent
a5c729af32
commit
e0f28cfe86
3 changed files with 12 additions and 21 deletions
|
@ -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);
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
|
|
@ -31,7 +31,6 @@ require('./vendors/farbtastic');
|
|||
require('./vendors/gritter');
|
||||
|
||||
const Cookies = require('./pad_utils').Cookies;
|
||||
const chat = require('./chat').chat;
|
||||
const getCollabClient = require('./collab_client').getCollabClient;
|
||||
const padconnectionstatus = require('./pad_connectionstatus').padconnectionstatus;
|
||||
const padcookie = require('./pad_cookie').padcookie;
|
||||
|
@ -585,31 +584,11 @@ const pad = {
|
|||
}
|
||||
},
|
||||
handleIsFullyConnected: (isConnected, isInitialConnect) => {
|
||||
pad.determineChatVisibility(isConnected && !isInitialConnect);
|
||||
pad.determineChatAndUsersVisibility(isConnected && !isInitialConnect);
|
||||
pad.determineAuthorshipColorsVisibility();
|
||||
setTimeout(() => {
|
||||
padeditbar.toggleDropDown('none');
|
||||
}, 1000);
|
||||
},
|
||||
determineChatVisibility: (asNowConnectedFeedback) => {
|
||||
const chatVisCookie = padcookie.getPref('chatAlwaysVisible');
|
||||
if (chatVisCookie) { // if the cookie is set for chat always visible
|
||||
chat.stickToScreen(true); // stick it to the screen
|
||||
$('#options-stickychat').prop('checked', true); // set the checkbox to on
|
||||
} else {
|
||||
$('#options-stickychat').prop('checked', false); // set the checkbox for off
|
||||
}
|
||||
},
|
||||
determineChatAndUsersVisibility: (asNowConnectedFeedback) => {
|
||||
const chatAUVisCookie = padcookie.getPref('chatAndUsersVisible');
|
||||
if (chatAUVisCookie) { // if the cookie is set for chat always visible
|
||||
chat.chatAndUsers(true); // stick it to the screen
|
||||
$('#options-chatandusers').prop('checked', true); // set the checkbox to on
|
||||
} else {
|
||||
$('#options-chatandusers').prop('checked', false); // set the checkbox for off
|
||||
}
|
||||
},
|
||||
determineAuthorshipColorsVisibility: () => {
|
||||
const authColCookie = padcookie.getPref('showAuthorshipColors');
|
||||
if (authColCookie) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue