Add a new 'rejected' disconnect reason

This reason will be used in a future commit that will reject erroneous
messages.
safari-is-slow
Richard Hansen 2020-09-12 23:51:32 -04:00 committed by John McLear
parent 13252c955c
commit 45ec8326f0
3 changed files with 28 additions and 3 deletions

View File

@ -90,6 +90,9 @@
"pad.modals.rateLimited": "Rate Limited.",
"pad.modals.rateLimited.explanation": "You sent too many messages to this pad so it disconnected you.",
"pad.modals.rejected.explanation": "The server rejected a message that was sent by your browser.",
"pad.modals.rejected.cause": "The server may have been updated while you were viewing the pad, or maybe there is a bug in Etherpad. Try reloading the page.",
"pad.modals.disconnected": "You have been disconnected.",
"pad.modals.disconnected.explanation": "The connection to the server was lost",
"pad.modals.disconnected.cause": "The server may be unavailable. Please notify the service administrator if this continues to happen.",

View File

@ -63,9 +63,26 @@ var padconnectionstatus = (function()
what: 'disconnected',
why: msg
};
var k = String(msg); // known reason why
if (!(k == 'userdup' || k == 'deleted' || k == 'looping' || k == 'slowcommit' || k == 'initsocketfail' || k == 'unauth' || k == 'rateLimited' || k == 'badChangeset' || k == 'corruptPad'))
{
// These message IDs correspond to localized strings that are presented to the user. If a new
// message ID is added here then a new div must be added to src/templates/pad.html and the
// corresponding l10n IDs must be added to the language files in src/locales.
const knownReasons = [
'badChangeset',
'corruptPad',
'deleted',
'disconnected',
'initsocketfail',
'looping',
'rateLimited',
'rejected',
'slowcommit',
'unauth',
'userdup',
];
let k = String(msg);
if (knownReasons.indexOf(k) === -1) {
// Fall back to a generic message.
k = 'disconnected';
}

View File

@ -283,6 +283,11 @@
<h1 data-l10n-id="pad.modals.rateLimited"></h1>
<p data-l10n-id="pad.modals.rateLimited.explanation"></p>
</div>
<div class="rejected">
<h1 data-l10n-id="pad.modals.disconnected"></h1>
<h2 data-l10n-id="pad.modals.rejected.explanation"></h2>
<p data-l10n-id="pad.modals.rejected.cause"></p>
</div>
<div class="disconnected with_reconnect_timer">
<% e.begin_block("disconnected"); %>
<h1 data-l10n-id="pad.modals.disconnected"></h1>