Commit Graph

15 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
Shubham Dhama 93ddf2ca37 ui_report: Remove now redundant `type` argument from `.message()`.
It's no longer used, as can be seen in
2d52463b61, in past we use `type` for
specifiying whether status is 'subscriptions-status' or else, which isn't
used now, hence `type` is removed here.
2019-01-17 10:28:59 -08:00
Tim Abbott 34f5218a0d ui_report: Add support for passing "".
I'm not really a fan of the "Failed:" pattern in some places, and this
lets us avoid it.
2018-12-18 12:33:42 -08: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
Tim Abbott 7ab8a8e820 js: Fix a bunch of indentation issues found by eslint.
This is preparation for enabling an eslint indentation configuration.
90% of these changes are just fixes for indentation errors that have
snuck into the codebase over the years; the others are more
significant reformatting to make eslint happy (that are not otherwise
actually improvements).

The one area that we do not attempt to work on here is the
"switch/case" indentation.
2018-05-06 16:25:02 -07:00
Armaan Ahluwalia 95634b9d17 ui: Add ability to hide ui feedback messages.
This adds the option to hide the container element after a given
duration in the message and success functions in the ui_report module.
2018-04-05 17:17:08 -07:00
Shubham Dhama eb0da20b78 settings: Clean up repeating code in error callbacks.
This cleans repeating code in error callback in settings.
We made a generic function in `ui_report.js` which require two
arguments `xhr` and `btn`; we preferred `btn` over `row` as argument
because a row may have more than one buttons.

Fixes: #8788.
2018-03-25 10:40:40 -07:00
Greg Price 756bbef1f2 Revert "settings: Check if xhr response text include ':' or not."
This reverts commit dd406e87e.  Whatever awkward error message might
have motivated that change, we can fix in a more targeted way when we
see it again.  This version would delete the potentially-informative
context the caller provided in `response` -- even just "Failed" --
based on whether an error message happened to contain a colon
somewhere in it, which is sure to end up feeling unpredictable.
2018-02-06 13:44:10 -08:00
YJDave ce43daa236 stream settings: Fix all dead code related to #subscriptions-status.
Remove all references of #subscriptions-status and add error handling
of stream settings endpoints.

Fixes #4647
2018-01-04 11:35:37 -05:00
YJDave dd406e87e9 settings: Check if xhr response text include ':' or not.
We join extra text message for notification and xhr response text by ':'.
Before joining, check if xhr response text already include ':', to
prevent notification with more than one ':'.
2017-12-28 15:54:57 -05:00
Steve Howell 7e4702c9c1 Avoid double-escaping HTML for settings notifications.
The i18n.t function already escapes HTML, so we should avoid
calling jQuery's text() method, which double escapes the HTML.

The symptom reported here was that if you changed your
timezone to something like like America/Mexico_City, you'd
see `&#x2F;` instead of `/`.

Most callers to the `ui_report` functions clearly call `i18n.t`
on the messages with code like this:

    ui_report.success(i18n.t("No changes to save!"), status);

There are some exceptions:

    blueslip.js: has really long hard coded messages
    reload.js: mostly says "Reloading...", which perhaps we should
               translate
    settings_account.js: uses helper functions
    settings_lab.js: uses local variable
    settings_org.js: i18n happens in property_types
    ui.js: uses generic_embed_error (unaffected by this change)

Fixes #7280
2017-11-07 09:52:20 -08:00
Brock Whittaker 32af99cd4d Display an error for the ZulipDesktop unsupported platform.
This displays an error at the top of the screen on page load that
will inform any user with the userAgent string "ZulipDesktop" that
they should upgrade to our newer electron app

Fixes: #6551.
2017-09-16 03:01:51 -07:00
Harshit Bansal 6615f2f2e8 common.js: Migrate `common.js` module to use IIFE module style.
This module was exposing its functions as globals. This PR fixes
it use the IIFE module style that we use in our other modules.
2017-06-22 19:06:32 -04:00
Brock Whittaker 34f9ccb87c alerts: Change sidebar alerts to be at top of the screen.
This changes the alerts to be individual boxes that slide down from
the top of the screen for a better UI experience.
2017-04-03 16:22:05 -07:00
Steve Howell 2d52463b61 Extract ui_report.js.
This moves the implementations of error/report/message from
ui.js to ui_report.js.  They had been shimmed before, so calling
modules still use the same names to call the functions, but we
no longer need the shims.
2017-04-03 07:13:25 -07:00