diff --git a/src/locales/en.json b/src/locales/en.json index 774dd0d41..5737fab00 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -172,9 +172,6 @@ "pad.savedrevs.timeslider": "You can see saved revisions by visiting the timeslider", "pad.userlist.entername": "Enter your name", "pad.userlist.unnamed": "unnamed", - "pad.userlist.guest": "Guest", - "pad.userlist.deny": "Deny", - "pad.userlist.approve": "Approve", "pad.editbar.clearcolors": "Clear authorship colors on entire document? This cannot be undone", "pad.impexp.importbutton": "Import Now", diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 26ded5039..279b08dfa 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -1013,9 +1013,7 @@ async function handleClientReady(socket, message, authorID) { }, automaticReconnectionTimeout: settings.automaticReconnectionTimeout, initialRevisionList: [], - initialOptions: { - guestPolicy: 'deny', - }, + initialOptions: {}, savedRevisions: pad.getSavedRevisions(), collab_client_vars: { initialAttributedText: atext, @@ -1028,7 +1026,6 @@ async function handleClientReady(socket, message, authorID) { }, colorPalette: authorManager.getColorPalette(), clientIp: '127.0.0.1', - userIsGuest: true, userColor: authorColorId, padId: message.padId, padOptions: settings.padOptions, diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index 43e6e3a25..a9d748494 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -72,7 +72,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) onClientMessage() {}, onInternalAction() {}, onConnectionTrouble() {}, - onServerMessage() {}, }; if (browser.firefox) { // Prevent "escape" from taking effect and canceling a comet connection; @@ -392,8 +391,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) // there are less than 100 messages or we reached the top if (chat.historyPointer <= 0) { $('#chatloadmessagesbutton').css('display', 'none'); } else // there are still more messages, re-show the load-button { $('#chatloadmessagesbutton').css('display', 'block'); } - } else if (msg.type == 'SERVER_MESSAGE') { - callbacks.onServerMessage(msg.payload); } // HACKISH: User messages do not have "payload" but "userInfo", so that all "handleClientMessage_USER_" hooks would work, populate payload @@ -586,9 +583,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) setOnConnectionTrouble(cb) { callbacks.onConnectionTrouble = cb; }, - setOnServerMessage(cb) { - callbacks.onServerMessage = cb; - }, updateUserInfo: defer(updateUserInfo), handleMessageFromServer, getConnectedUsers, diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 9a848736f..d75e1c4f0 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -337,9 +337,6 @@ var pad = { getPrivilege(name) { return clientVars.accountPrivs[name]; }, - getUserIsGuest() { - return clientVars.userIsGuest; - }, getUserId() { return pad.myUserInfo.userId; }, @@ -440,7 +437,6 @@ var pad = { pad.collabClient.setOnUpdateUserInfo(pad.handleUserUpdate); pad.collabClient.setOnUserLeave(pad.handleUserLeave); pad.collabClient.setOnClientMessage(pad.handleClientMessage); - pad.collabClient.setOnServerMessage(pad.handleServerMessage); pad.collabClient.setOnChannelStateChange(pad.handleChannelStateChange); pad.collabClient.setOnInternalAction(pad.handleCollabAction); @@ -537,18 +533,11 @@ var pad = { } padeditor.setViewOptions(pad.padOptions.view); } - if (opts.guestPolicy) { - // order important here - pad.padOptions.guestPolicy = opts.guestPolicy; - } }, getPadOptions() { // caller shouldn't mutate the object return pad.padOptions; }, - isPadPublic() { - return pad.getPadOptions().guestPolicy == 'allow'; - }, suggestUserName(userId, name) { pad.collabClient.sendClientMessage( { @@ -579,9 +568,6 @@ var pad = { } else if (msg.type == 'padoptions') { const opts = msg.options; pad.handleOptionsChange(opts); - } else if (msg.type == 'guestanswer') { - // someone answered a prompt, remove it - paduserlist.removeGuestPrompt(msg.guestId); } }, dmesg(m) { @@ -594,21 +580,6 @@ var pad = { } } }, - handleServerMessage(m) { - if (m.type == 'NOTICE') { - if (m.text) { - alertBar.displayMessage((abar) => { - abar.find('#servermsgdate').text(` (${padutils.simpleDateTime(new Date())})`); - abar.find('#servermsgtext').text(m.text); - }); - } - if (m.js) { - window['ev' + 'al'](m.js); - } - } else if (m.type == 'GUEST_PROMPT') { - paduserlist.showGuestPrompt(m.userId, m.displayName); - } - }, handleChannelStateChange(newState, message) { const oldFullyConnected = !!padconnectionstatus.isFullyConnected(); const wasConnecting = (padconnectionstatus.getStatus().what == 'connecting'); @@ -695,9 +666,6 @@ var pad = { padeditbar.setSyncStatus('done'); } }, - hideServerMessage() { - alertBar.hideMessage(); - }, asyncSendDiagnosticInfo() { window.setTimeout(() => { $.ajax( @@ -743,35 +711,6 @@ var pad = { }, }; -var alertBar = (function () { - const animator = padutils.makeShowHideAnimator(arriveAtAnimationState, false, 25, 400); - - function arriveAtAnimationState(state) { - if (state == -1) { - $('#alertbar').css('opacity', 0).css('display', 'block'); - } else if (state == 0) { - $('#alertbar').css('opacity', 1); - } else if (state == 1) { - $('#alertbar').css('opacity', 0).css('display', 'none'); - } else if (state < 0) { - $('#alertbar').css('opacity', state + 1); - } else if (state > 0) { - $('#alertbar').css('opacity', 1 - state); - } - } - - const self = { - displayMessage(setupFunc) { - animator.show(); - setupFunc($('#alertbar')); - }, - hideMessage() { - animator.hide(); - }, - }; - return self; -}()); - function init() { return pad.init(); } @@ -794,4 +733,3 @@ exports.getUrlVars = getUrlVars; exports.handshake = handshake; exports.pad = pad; exports.init = init; -exports.alertBar = alertBar; diff --git a/src/static/js/pad_userlist.js b/src/static/js/pad_userlist.js index 30b488019..54e7fd4a8 100644 --- a/src/static/js/pad_userlist.js +++ b/src/static/js/pad_userlist.js @@ -352,26 +352,6 @@ const paduserlist = (function () { jqueryNode.removeAttr('disabled').addClass('editable'); } - const knocksToIgnore = {}; - let guestPromptFlashState = 0; - const guestPromptFlash = padutils.makeAnimationScheduler( - - () => { - const prompts = $('#guestprompts .guestprompt'); - if (prompts.length == 0) { - return false; // no more to do - } - - guestPromptFlashState = 1 - guestPromptFlashState; - if (guestPromptFlashState) { - prompts.css('background', '#ffa'); - } else { - prompts.css('background', '#ffe'); - } - - return true; - }, 1000); - var pad = undefined; var self = { init(myInitialUserInfo, _pad) { @@ -383,18 +363,16 @@ const paduserlist = (function () { $('#otheruserstable tr').remove(); - if (pad.getUserIsGuest()) { - $('#myusernameedit').addClass('myusernameedithoverable'); - setUpEditable($('#myusernameedit'), () => myUserInfo.name || '', (newValue) => { - myUserInfo.name = newValue; - pad.notifyChangeName(newValue); - // wrap with setTimeout to do later because we get - // a double "blur" fire in IE... - window.setTimeout(() => { - self.renderMyUserInfo(); - }, 0); - }); - } + $('#myusernameedit').addClass('myusernameedithoverable'); + setUpEditable($('#myusernameedit'), () => myUserInfo.name || '', (newValue) => { + myUserInfo.name = newValue; + pad.notifyChangeName(newValue); + // wrap with setTimeout to do later because we get + // a double "blur" fire in IE... + window.setTimeout(() => { + self.renderMyUserInfo(); + }, 0); + }); // color picker $('#myswatchbox').click(showColorPicker); @@ -551,56 +529,6 @@ const paduserlist = (function () { self.updateNumberOfOnlineUsers(); }, - showGuestPrompt(userId, displayName) { - if (knocksToIgnore[userId]) { - return; - } - - const encodedUserId = padutils.encodeUserId(userId); - - const actionName = `hide-guest-prompt-${encodedUserId}`; - padutils.cancelActions(actionName); - - let box = $(`#guestprompt-${encodedUserId}`); - if (box.length == 0) { - // make guest prompt box - box = $(`