Commit Graph

107 Commits

Author SHA1 Message Date
Anders Kaseorg 28f3dfa284 js: Automatically convert var to let and const in most files.
This commit was originally automatically generated using `tools/lint
--only=eslint --fix`.  It was then modified by tabbott to contain only
changes to a set of files that are unlikely to result in significant
merge conflicts with any open pull request, excluding about 20 files.
His plan is to merge the remaining changes with more precise care,
potentially involving merging parts of conflicting pull requests
before running the `eslint --fix` operation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-03 12:42:39 -08:00
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
Anders Kaseorg db0b33842c templates: Replace templates.render with require calls.
This removes an unnecessary layer of indirection and allows webpack to
catch filename mistakes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg 3c3471b720 templates: Rename *.handlebars ↦ *.hbs and - ↦ _.
Tweaked by tabbott to avoid accidentally disabling the linter for
handlebars templates.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:03 -07:00
Thomas Ip f6aaf43029 refactor: Use explicit path when referencing handlebars templates. 2019-07-02 16:23:30 -07:00
Pragati Agrawal 747e797092 stream settings: Disable Mobile notifications if push bouncer not set up.
This commit disables "Mobile notifications" if `push_notifications` are not
enabled. It also adds a tooltip explaining why this is disabled.

Fixes #12208
2019-06-24 14:46:45 -07:00
Yashashvi Dave 84234cabcb stream settings: Disable click handler on label for mute settings.
If stream setting is disabled, setting-checkbox can not be
clicked. Although, it does allow to change value by clicking
on setting label.
This commit fixes above bug and disable click handler on
setting-label for disabled stream settings.
2019-06-24 14:46:45 -07:00
Yashashvi Dave 88f3325970 stream settings: Deduplicate stream settings click handlers. 2019-06-24 14:46:45 -07:00
Yashashvi Dave 1b9c1a7898 stream settings: Deduplicate template rendering. 2019-06-24 14:46:45 -07:00
Yashashvi Dave de1f4066ba stream settings: Change settings element-id to match with pattern.
Change element ids of `is_muted` and `pin_to_top` settings,
to macth with the pattern of other stream settings.

This is preparatory refactor to support removing code duplication in
the stream settings templates.
2019-06-24 14:46:22 -07:00
Yashashvi Dave 25dbda1e53 stream settings: Fix bug in deactivate stream modal appearance.
Stream deactivation modal should be append to main
unique id, stream overlay element.
This commit also add `new-style` class to modal.

Fixes #12394
2019-06-20 11:09:52 -07:00
Yashashvi Dave 8e269b4651 models: Rename notification to `enable_stream_audible_notifications`.
Rename notification property `enable_stream_sounds` to
`enable_stream_audible_notifications` to match with other
notification property patterns.

Fixes part of #12304
2019-06-12 16:24:51 -07:00
YashRE42 869aaba6a7 overlays: Fix stream edit click-through bug.
Fixes #12369.
2019-06-06 14:57:16 -07:00
Yashashvi Dave 7d75cdef7f subs: Rename `in_home_view` checkbox-setting template element. 2019-05-30 21:39:06 -07:00
Yashashvi Dave 40f550038d subs: Replace all `in_home_view` uses with `is_muted` property.
Replace all uses of `in_home_view` subscription property
with `is_muted` property in frontend.

Fixes #12322
2019-05-30 21:39:06 -07:00
Anders Kaseorg 01613e71fb ui: Replace set_up_scrollbar with data-simplebar attribute.
With perfectScrollbar, we needed to call a function from JavaScript to
enable a scrollbar on a new element, but simplebar has a much simpler
default API one can do by using data-simplebar attributes in the HTML.

So we can delete all the scrollbar creation/deletion code.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-19 18:06:38 -07:00
Anders Kaseorg 141088586b Completely replace perfect-scrollbar with SimpleBar.
perfect-scrollbar replaces both the appearance and the behavior of the
scrollbar, and its emulated behavior will never feel native on most
platforms.  SimpleBar customizes the appearance while preserving the
native behavior.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-05-17 12:06:51 -07:00
Harshit Bansal b553507412 subscriptions: Migrate notification setting defaults model.
This commit migrates the Subscription's notification fields from a
BooleanField to a NullBooleanField where a value of None means to
inherit the value from user's profile.

Also includes a migrations to set the corresponding settings to None
if they match the user profile's values. This migration helps us in
getting rid of the weird "Apply to all" widget that we offered on
subscription settings page.

The mobile apps can't handle None appearing as the stream-level
notification settings, so for backwards-compatibility we arrange to
only send True/False to the mobile apps by applying those defaults
server-side.  We introduce a notification_settings_null value within a
client_capabilities structure that newer versions of the mobile apps
can use to request the new model.

This mobile compatibility code is pretty effectively tested by the
existing test_events tests for the subscriptions subsystem.
2019-05-08 17:45:10 -07:00
Yashashvi Dave 02a1b2e26b server events: Add realm-time-sync event to update stream privacy.
Add event to update stream settings whenever stream privacy is changed
accordingly.

Fixes #9470
2019-05-07 17:33:59 -07:00
Yashashvi Dave fbf25942d0 streams: Extract change-stream-permissions functions. 2019-05-07 17:33:59 -07:00
Yashashvi Dave ccd3b49555 streams: Disable sub-btn with explanation if user not allowed to subscribe. 2019-05-07 16:38:36 -07:00
Yashashvi Dave bfabb86f39 stream hash: Update hash before updating settings UI elements. 2019-05-06 17:30:33 -07:00
Yashashvi Dave 6ae6da5d22 stream_ui_updates: Move function `update_add_subscriptions_elements`. 2019-05-06 17:30:33 -07:00
Yashashvi Dave 71e561de76 stream_ui_updates: Extract `update_subscribers_list` function. 2019-05-06 17:30:33 -07:00
Yashashvi Dave 4cd33f23bc stream_ui_updates: Refactor update-stream-privacy-type function. 2019-05-06 17:30:33 -07:00
Yashashvi Dave d86ee6b4f0 stream_ui_updates: Extract `update_stream_privacy` function. 2019-05-06 17:30:33 -07:00
Yashashvi Dave 7a168216ff stream_ui_updates: Extract `update_change_stream_privacy_settings`. 2019-04-30 14:37:30 -07:00
Yashashvi Dave ecc165b899 stream_ui_updates: Extract `update_regular_sub_settings`. 2019-04-30 14:37:24 -07:00
Yashashvi Dave a71eb6aa15 subs: Extract change-stream-privacy block from function.
This commit removes code to update-stream-privacy-btn
in stream settings from update-sub-settings function.
Because stream-privacy-btn is not part of regular
sub-settings, it is admins only settings.
2019-04-30 14:36:52 -07:00
Yashashvi Dave 9dd9ea5721 stream settings: Update URL when opening empty settings panel. 2019-04-30 14:36:52 -07:00
Yashashvi Dave 460515a2ee stream settings: Extract `setup_subscriptions_tab_hash` function. 2019-04-30 14:36:52 -07:00
Yashashvi Dave ec5ef08a19 subs: Fix URL not updating as per UI on stream unsubscription.
When user unsubscribe from stream by clicking on
subscription-checkmark, the URL changes to unsubscribed
stream but stream settings UI is not updated.
We should change URL and stream settings modal
simultaneously. This PR moves update-hash function
inside open-stream-modal function, which make sure that
URL is getting updated everytime open-stream-modal
function is called and not otherwise.
2019-04-30 14:37:19 -07:00
Tim Abbott 60f33a374d streams: Fix announcement-only option being hidden.
Fixes an unpleasant regression in
746870df65.
2019-02-27 13:29:45 -08:00
Hemanth V. Alluri 77f24e2b56 click_handlers: Use stream desc. on edit instead of rendered desc.
On clicking the edit button for a stream description, the stream's
unrendered description should be made editable as text instead of
the stream's rendered description (which would be displayed as HTML
instead of text).

This completes the effort to use backend-rendered stream descriptions
here.  Fixes #11272.
2019-02-11 12:27:11 -08:00
Yashashvi Dave e8fbd855e6 subscriptions: Add tooltip, only subscribers can add user in private stream.
Add explanation in popover on disabled add-subscriptions input elements,
admin can't add subscribers to non subscribed private streams, only
subscribed users can.

Fixes #10593
2019-01-05 16:21:41 -08:00
Steve Howell 623e3f3c9f hashchange: Extract hash_util.stream_edit_uri. 2018-12-02 19:07:19 -08:00
Steve Howell 84d0b541e3 hashchange: Add hashchange.update_browser_history().
This helps us encapsulate the situation where we don't
want to trigger hashchanged(), without having to do it
within sub.js with prevent_once().
2018-12-02 19:07:10 -08:00
Steve Howell bea328b8b6 refactor: Split out functions for opening edit panel.
While they can share some code, opening the edit panel
for a stream and clearing the panel are pretty different
actions, so we simplify the API for each thing.

You no longer have to pass in booleans, and for the clear
case, you don't have to pass in a bogus node that just
gets ignored.
2018-12-02 18:40:00 -08:00
Steve Howell c91b804683 bug fix: Handle "Subscribe" button in empty views.
I don't know how long this has been broken, but it seems
some re-design of our message feed moved the Subscribe
button out #zfilt, so we use a different parent selector
now to turn on the click handler.

Hopefully this was a pretty obscure bug.  To reproduce
it go to "Manage Streams" and then select a stream you're
not subscribed to (from "All Streams"), and don't actually
subscribe, but then hit "View stream".

The user experience here is still a bit confusing, but
this is just a quick fix.
2018-09-28 14:08:37 -07:00
Yashashvi Dave 069acc08cd stream settings: Fix hide change-sub-type when admin unsubscribe stream.
Fixes #10163
2018-08-13 12:14:01 -07:00
Yashashvi Dave 55325b71a4 stream settings: Display nothing-selected when active-stream is deleted.
Display nothing-selected in stream settings tab, if we get delete-stream
event of active-stream(which stream's settings tab is opened) in
frontend.
2018-08-07 13:30:53 -07:00
Shubham Padia 7d6ee2e10a stream_edit: Display server error message when subscribing other users. 2018-07-31 11:12:09 -07:00
Sarah de2ec8a05c notification settings: Add UI for stream email notifications.
Previous commits have fully implemented the logic for stream email
notifications; this final commit adds support for configuring it to
the UI.

Fixes #6511.
2018-07-14 12:19:33 +05:30
Aditya Bansal ae6c8692a9 subscriptions_settings_modal: Upgrade to font-awesome 4.7 icon prefixes. 2018-07-11 20:17:11 +05:30
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
Shubham Dhama 2aba7c239f list_render: Make list creation logic as an export in list_render module.
This changes how we create lists i.e.
    from `list_render($container, list, opts)`
        to `list_render.create($container, list, opts)`
2018-06-22 09:21:47 -04:00
Shubham Dhama 80a2d5bc59 eslint: Enable `conditionalAssign` config of no-trailing-spaces rule. 2018-06-11 07:51:24 -04:00
Shubham Dhama dcb6254a4e eslint: Enable `no-extra-parens` rule.
Following sub-configuration is disabled:
                "nestedBinaryExpressions": false,
2018-06-11 07:51:24 -04:00
Shubham Dhama cc03f9fb8f eslint: Enable space-infix-ops rule.
More about rule at  https://eslint.org/docs/rules/space-infix-ops
2018-06-05 00:47:35 +05:30
Shubham Dhama c6738889a9 eslint: Add and enable `space-unary-ops` rule.
Info about rule at https://eslint.org/docs/rules/space-unary-ops.
2018-06-05 00:47:35 +05:30