Embedding this in index.html won't work anymore, because the Django FastCGI and
the Tornado servers might have been started at different times.
(imported from commit 187909d0593449cf2989857671f9ca526723e451)
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)
We had this fascinating behavior where pressing a down arrow near the
end of the page would advance the pointer, call recenter_view, which
would trigger a scroll event, which would call keep_pointer_in_view,
which would notice that we were at the end of the page and advance the
pointer again!
I split out that last part into its own function which is only called
on mousewheel events.
(imported from commit bc85443e762356e3055f8f88585940a1f11f9124)
This also helps us manage checking, case-insensitive, for
subscriptions while preserving the casing used by the class creator
for display.
It also fixes a bug where the class_list would become out of sync with
your true subscriptions, allowing you to appear to send messages to
classes to which you had unsubscribed.
(imported from commit 5e8d017bcfb27a71c52f7517733eda7b926d721b)
Rather than trying to keep track of whether the last thing that
happened was an input area being focused (which had all kinds of
bugs), just detect whether we're in an input area using the
appropriate jquery selector. Hopefully this has OK performance.
(imported from commit 6150692ffcb0ab9b04244c3d053b5527847ded2d)
It is confusing, and clicking on it should behave like clicking
elsewhere in the message.
(imported from commit e56434e8e143f6fa58b095e1c7d311b4aa24313f)
The new version is now the only codepath that we use in order to start
a reply to a message.
(imported from commit dd28316d2640fd5fd712f326690d480b7db59c4c)
This is somewhat experimental and we may need to work on the condition
when it shows up (or move it elsewhere).
Also, maybe it should say "Today/Yesterday" for times super close to
now -- the main issue with doing this is whether it needs to update
without your reloading the page to avoid being super confusing.
(imported from commit e29faf30c83b9574e5d233213f42a24175f9a616)
It causes problems when [un]narrowing, and we already do the rest of formatting
on the server side.
This reverts commit 90af0192b37bbebbf56d5e7c50f182485ddbca10.
This reverts commit df7e355648d2c4d6319de049933547ed96402fd8.
(imported from commit 99d87f0826ec2f49741f86fad6524ed93e76723f)