Commit Graph

18 Commits

Author SHA1 Message Date
Anders Kaseorg d17b577d0c js: Purge useless IIFEs.
With webpack, variables declared in each file are already file-local
(Global variables need to be explicitly exported), so these IIFEs are
no longer needed.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-25 13:51:21 -07:00
Armaan Ahluwalia 6d255efe4c app: Prepare JS files for consumption by webpack.
This commit prepares the frontend code to be consumed by webpack.

It is a hack: In theory, modules should be declaring and importing the
modules they depend on and the globals they expose directly.

However, that requires significant per-module work, which we don't
really want to block moving our toolchain to webpack on.

So we expose the modules by setting window.varName = varName; as
needed in the js files.
2018-07-05 10:53:36 +02:00
Greg Price 192ec7c0f6 middleware: Use a proper error code on CSRF failure.
This allows us to reliably parse the error in code, rather than
attempt to parse the error text.  Because the error text gets
translated into the user's language, this error-handling path
wasn't functioning at all for users using Zulip in any of the
seven non-English languages for which we had a translation for
this string.

Together with 709c3b50f which fixed a similar issue in a
different error-handling path, this fixes #5598.
2017-07-25 14:02:12 -07:00
Steve Howell ef815e9e79 Remove unused channel.abort_all(). 2017-06-30 09:48:04 -04:00
Tim Abbott 2eacc7317d reload: Remove cleanup_before_reload logic.
Zulip's logic for garbage-collecting data structures before reloading
was a fix for a Chrome memory leak that lasted across reloads a few
years ago.  That memory leak is probably now fixed, and thus logic is
causing lots of JavaScript tracebacks that are probably not useful.

So, let's try removing this cleanup logic (everything but the
still-useful deletion of the event queue).
2017-03-27 13:23:10 -07:00
Rafid Aslam 7856217a63 Migrate JS modules to CommonJS style.
Closes #1488.
2016-12-07 16:11:52 -08:00
lonerz dc6849952b eslint: change space-before-function-paren from warning to error.
Also fix violations.
2016-12-05 09:50:37 -08:00
Brock Whittaker e52d618f1b Switching from $.parseJSON to JSON.parse.
There are no modern browsers that do not have built in JSON parsing
abilities. We do not need $.parseJSON as it now just serves as a call
to JSON.parse.
2016-08-25 14:22:48 -07:00
Tim Abbott 05acd510c0 Make reload save options required explicit arguments. 2015-11-30 08:49:39 -08:00
Tim Abbott 5f25974737 Fix Javascript whitespace issues with {. 2015-11-10 10:01:34 -08:00
Steve Howell 3889edd824 Move xhr_error_message() into channel.js
(imported from commit c68c2d475b5673a3dd5f68c75624dfcfe56728ca)
2014-03-14 20:48:53 -04:00
Tim Abbott 37dffa0f2d channel: Improve handling of non-JSON format 403 responses.
(imported from commit 942a830155c84741e67605672c837b431cca8af7)
2014-02-10 17:05:34 -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
Steve Howell 6d963c4a85 Always set data.method=PATCH in channel.patch()
(imported from commit 242503c1caa670fa219acbfe811a1b5e5d54f2b6)
2014-01-16 13:41:53 -05:00
Tim Abbott 7f174213ed Add an idempotent flag to the channel module.
(imported from commit d5b867d2a8f176cae76c8b68435c4fab318d998b)
2014-01-10 21:39:00 -05:00
Tim Abbott e76eac49cb Reload the browser on CSRF token errors.
We've seen in our error logs browser clients that were constantly
retrying requests to our server after the user logged out in one tab
but didn't close another.

(imported from commit 68dd8d9e618083bc116ae3a96dbcc78fa9301bba)
2013-12-19 16:52:52 -05:00
Tim Abbott 795930c803 Add channel module wrapping our various JSON requests to the server.
(imported from commit 6489938678551ad8594822363ae6d1c9ae295496)
2013-12-19 16:52:47 -05:00