diff --git a/src/locales/en.json b/src/locales/en.json index 33c30b50a..4e9fb33de 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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.", diff --git a/src/static/js/pad_connectionstatus.js b/src/static/js/pad_connectionstatus.js index ad9fe0855..a27243322 100644 --- a/src/static/js/pad_connectionstatus.js +++ b/src/static/js/pad_connectionstatus.js @@ -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'; } diff --git a/src/templates/pad.html b/src/templates/pad.html index bd718c77d..49aa20204 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -283,6 +283,11 @@

+
+

+

+

+
<% e.begin_block("disconnected"); %>