Commit Graph

20 Commits

Author SHA1 Message Date
Tim Abbott 6d2ae9abbc Fix cleanup_event_queue being called multiple times during reload.
Apparently it isn't always the case that removal of jquery and the DOM
prevents cleanup_event_queue from being called via the postunload
hook, so add a check to avoid it being double-called.
2016-03-30 23:09:16 -07:00
Tim Abbott 05acd510c0 Make reload save options required explicit arguments. 2015-11-30 08:49:39 -08:00
Dylan Dumesnil 24b63f30ba Refactor reload.js to allow saving only some state when reloading.
The reload state is now divided into 3 different components:
  pointer, narrow, compose
2015-11-30 08:47:36 -08:00
Tim Abbott 5f25974737 Fix Javascript whitespace issues with {. 2015-11-10 10:01:34 -08:00
Jason Michalski fa440d0be2 Only empty the message list DOM on reload
We are seeing error on CUSTOMER4 when clearing the DOM on reload. So
now we will only clear the message list.

(imported from commit f5d8d7d36cd1018f7def73ff9eda414387fcec5c)
2014-03-14 20:48:58 -04:00
Jason Michalski c753dfc9a8 Move reload initiation to an explicit initialize function
The reload initiation is required to run before other parts of the site
are started so that page_params will be setup correctly. This moves that
initiation out of an on ready handler to an explicit initialize call
near where the rest of the app is started.

(imported from commit b8994311299327aa3cfa57e3d9e92124a47123f4)
2014-03-03 18:17:15 -05:00
Jason Michalski 5ad256fee7 Fix navigating away from the page in Firefox
When navigating away get_events will fail after we delete the event
queue before leaving the page. In that case we try to reload the page to
correct the problem. This happens before the page navigation is
complete, and then we reload zulip keeping the user captive. This was
only observed on on Firefox.

(imported from commit e001172e87a9f2ab7cf07a477e46b9d87752ac04)
2014-02-27 20:25:26 -05:00
Tim Abbott fcb8c106b1 Fix saving of pointer on server-initiated reload when narrowed.
Previously, we saved the current_msg_list selected id and then
restored it as the home_msg_list selected id, which could result in
the home view loading to the wrong place.

This takes some already bad code and makes it even more in need of
refactoring, but it does fix a pressing bug.  We should definitely
refactor both:

* the top of narrow.js
* the save/restore code in reload.js

after this, though.

(imported from commit bb2040219e4f545ba90bb04a696996cec2831484)
2014-02-12 14:40:38 -05:00
Jason Michalski c028dbe6b9 Put the reload GC changes behind a feature_flag
(imported from commit b009c2f4e5d76573902f335fb1a3b74622af6191)
2014-02-10 15:41:32 -05:00
Jason Michalski 47ca6b2800 Add ajax request tracking and aborting to channel
The channel module now keeps track pending ajax requests and has an
abort_all function to angle all pending requests.

(imported from commit 4e78ab24d2295bd67de5633e3a200dfa489825b1)
2014-02-10 15:41:32 -05:00
Jason Michalski f1e110c177 Empty large collections and remove event listeners before reload
Chrome was showing a memory leak after many auto-reloads. Emptying the
the collections and removing the event listeners reduces the severity.
Before this change 40 reloads would would grow to about 140MB, now it
stays around 50MB.

(imported from commit 55fbeff9bdd0363bb95929f2981a2de238ff35d8)
2014-02-06 16:42:38 -05:00
Tim Abbott 1bd9e5809c Restore the browser's scroll position on server-initiated reload.
(imported from commit 934659c0f1a2c014cfd2811fe49ea31abad262b2)
2014-02-06 10:25:35 -05:00
Tim Abbott 1eb294ed11 Rename get_updates to get_events in the frontend.
We did this rename on the backend ages ago.

(imported from commit 11bdf6aa08d932fe2586de282f6174e3dba7267a)
2014-01-30 17:23:52 -05:00
Tim Abbott 9fcca3df4e [schema] Collect data on when users are active on site.
These engagement data will be useful both for making pretty graphs of
how addicted our users are as well as for allowing us to check whether
a new deployment is actually using the product or not.

This measures "number of minutes during which each user had checked
the app within the previous 15 minutes".  It should correctly not
count server-initiated reloads.

It's possible that we should use something less aggressive than
mousemove; I'm a little torn on that because you really can check the
app for new messages without doing anything active.

This is somewhat tested but there are a few outstanding issues:

* Mobile apps don't report these data.  It should be as easy as having
  them send in update_active_status queries with new_user_input=true.

* The semantics of this should be better documented (e.g. the
  management script should print out the spec above)x.

(imported from commit ec8b2dc96b180e1951df00490707ae916887178e)
2013-09-10 13:25:59 -04:00
Tim Abbott f6b7aed0c9 Save the original initial_pointer when updating it on reload.
(imported from commit 1fe4332282e521240d3a24428f3f7c318233258a)
2013-08-13 18:09:19 -04:00
Scott Feeney c56353138d Fix tracebacks on reload while composing
(imported from commit 5ba1c93b8af015197e77bd16ef9178a6e743a849)
2013-07-30 13:10:50 -04:00
Scott Feeney a35fff90cc Replace $.extend
(imported from commit 2c1ee3c2714d388f2a71398fe81c049cc54ff94d)
2013-07-30 12:12:59 -04:00
Scott Feeney 8703134a23 Replace $.each with _.each
In a few cases the $.each was doing something imperatively that was
terser and easier to understand by using a different Underscore method,
so a few of these I rewrote.

Some code was using the fact that jQuery sets `this` in the callback to
be the item; I rewrote those to use an explicit parameter.

Some code was using $(some selector).each(callback). I converted these
to _.each($(some selector), callback).

One function, ui.process_condensing, was written to be a jQuery $.each
callback despite being in a totally different module from code using it.
I noticed this and updated the function's args.

(imported from commit bf5922a35f257c168cc09ec1d077415d6ef19a03)
2013-07-30 12:12:58 -04:00
Tim Abbott bc4d7c687d Rename our custom JS events to use Zulip, not Zephyr.
(imported from commit 61ac456d394a6dbc14f3e9183a53313990db5059)
2013-07-29 12:11:26 -04:00
Tim Abbott 3bba0cc927 Move zephyr/static to just static.
It's not really a part of the server (aka the rest of zephyr/).

(imported from commit 27f6b6b064938ad927075a68d873e4b68710d279)
2013-07-29 12:11:26 -04:00