zulip/zephyr
Zev Benjamin fab64fd7b0 Make the client reload the page when it detects a server restart
If the client is not composing a message, we can just force a page
reload.  However, if he is composing a message, we must preserve that
message while still reloading as soon as possible.

We take the following approach: if the client has not completed the
composition after 5 minutes, do a compose-preserving reload
(described below).  If he sends the message before the timeout
expires, reload the page after a successful send.  If the send fails
(not due to server timeout), however, we do a compose-perserving
reload in case the error was due to the data format changing.  If the
send failed due to server timeout, we don't reload because the reload
will probably also fail.

In a compose-preserving reload, we redirect to an URI that has a
fragment indicating we are doing a reload and containing all the
necessary information for restoring the compose window to its
previous state.  On page load, we check the fragment to see if we
just did a compose-preserving reload, and, if we did, we restore the
compose window (or just try the send again in the case of send
failure).  The URI fragment looks like:

(imported from commit af4eeb3930c24118e088057d4da456748fbd2229)
2012-10-16 15:30:41 -04:00
..
fixtures Rename zephyrs.json => messages.json in .gitignore. 2012-10-10 10:39:27 -04:00
jstemplates Eliminate some inline styles (visibility: collapse). 2012-10-15 22:47:41 -04:00
lib Markdown: Disable headings using our extension 2012-10-16 11:39:00 -04:00
management Add social and test to default subs added after DB dumps. 2012-10-11 11:53:57 -04:00
static Make the client reload the page when it detects a server restart 2012-10-16 15:30:41 -04:00
tests gitignore zephyr/tests/zephyrdb.test 2012-10-11 16:25:40 -04:00
__init__.py Initial Django commit: basic account, zephyr stream, narrowing, etc. 2012-08-28 12:44:51 -04:00
context_processors.py Hide most of the navbar on the deployed app 2012-10-15 18:44:36 -04:00
decorator.py Remove unused imports 2012-09-07 13:57:32 -04:00
forms.py Implement confirmation for new user signups. 2012-10-01 10:45:58 -04:00
models.py Some import cleanup 2012-10-15 16:16:10 -04:00
tests.py Fix test broken by 0917d5c2ed1b156603ce53aaec88ecbe26f5f39c 2012-10-12 14:30:23 -04:00
views.py Have client and server exchange a server generation number 2012-10-16 15:30:09 -04:00