Commit Graph

172 Commits

Author SHA1 Message Date
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
Anders Kaseorg 84bc2186eb settings_org.js: Remove var parse_time_limit.
It would conflict with `exports.parse_time_limit` after migration to
an ES6 module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-04 16:50:23 -07:00
Thomas Ip f6aaf43029 refactor: Use explicit path when referencing handlebars templates. 2019-07-02 16:23:30 -07:00
Pragati Agrawal e42abc2396 org_settings: Optimize data collected by `populate_data_for_request`.
With the help of `check_property_changed` function now we collect the data
whose values are changed from the current one. Currently this optimizes
only for those elements whose values are collected by
`populate_data_for_request` function i.e. it doesn't optimize data
collected by `get_complete_data_for_subsection`.
2019-06-25 16:57:59 -07:00
Pragati Agrawal bdbf63ed27 org_settings: Move `populate_data_for_request` down.
This is preliminary commit which moves `populate_data_for_request` function
down after the definition of all functions with which it will interact in
the future.
2019-06-25 16:57:59 -07:00
Pragati Agrawal 81492362d7 org_settings: Refactor `populate_data_for_request`.
This is a preliminary commit which refactors `populate_data_for_request`
function, now this function traverse on all "property elements" of a given
subsection, but get the data only of those properties which have
`setting-widget-type` data attribute. Therefore, it doesn't change the
functionality of this function and overall changes don't make any
difference. In upcoming commits, we're going to use `input_elem` as an
argument to `check_property_changed` function, so that only those elements
whose values are changed are sent to the backend.
2019-06-25 16:57:59 -07:00
Pragati Agrawal d200d662d7 org_settings: Move `get_subsection_property_elements` from `build_page`.
This moves `get_subsection_property_elements` out from the local context of
`settings_org.build_page` function, as it was unnecessarily initialized at
the time of page setup.
2019-06-25 16:57:59 -07:00
Hemanth V. Alluri 52a5474000 realm_plan_type: Restrict uploading organization logos by plan type.
Using the page_param variable "plan_includes_wide_organization_logo"
disallow users in a realm with a "LIMITED" plan type from uploading
their own wide organization logos and instead suggest that they
upgrade their plan using the page_param variable
"upgrade_text_for_wide_organization_logo" for the suggestion message.

Backend validation for this feature already exists.
2019-06-14 16:21:12 -07:00
Rishi Gupta 799d6b9203 org settings: Standardize strings in Other permissions section.
Also, options are now ordered from most restrictive to least restrictive.
A standard style here will be easier to understand and maintain as we add
more settings here.
2019-06-12 17:02:04 -07:00
Shubham Dhama 03d188b5bd settings_org: Fix show_email function when email visibility is admin only.
`show_email` function should return false when email visibility is set
anything other than `everyone` (, for now, irrespective of privileges).
2019-05-30 16:22:54 -07:00
Shubham Dhama c691ed433b settings_org: Fix the typo in `settings_org.show_email()` function. 2019-05-30 16:22:54 -07:00
David Wood 6b9a9b1e31 org settings: Extract setting for new user waiting period.
This commit separates the `waiting_period_threshold` setting from
the `create_stream_policy` setting, adding a new setting that the user
can use to select a waiting period threshold.

Both the invite to stream policy and create stream policy now have
three options: admins only, members and admins, or members after
waiting period/admins.
2019-05-21 17:36:48 -07:00
David Wood 24cb31329c org settings: Fix dropdown value inconsistency.
The value in the handlebars template for `invite_to_stream_policy`
is inconsistent with the value in the js file. Changing all three
occurances to a third value, since that's the one we'll want moving
forward.

Co-Authored-By: Rishi Gupta <rishig@zulipchat.com>
2019-05-21 17:36:47 -07:00
Pragati Agrawal cdc50090b6 popovers: Hide email under hidden email-address-visibility cases.
In email hidden case (that is when `email_address_visibilty` is set to
everyone), for "non admins", this commit hides emails from:
- user popover
- custom profile popover
In email hidden case, for admins, email is shown in both user popovers and
custom profile popovers.
2019-05-20 15:56:21 -07:00
Pragati Agrawal 4df971c3c2 org settings: Add save/discard widget for realm authentication methods.
Along with this, we refactored settings_org.populate_auth_methods to use
HTML function after rendering all auth methods rows rather than appending
each row individually, which actually is a good practice.

Also in this commit, to compare `current_val` and `changed_val` in
`check_property_changed` function of the property
`realm_authentication_methods`, which are objects, and we found here
https://stackoverflow.com/a/1144249 that there is no easy way to do so. So
I followed this approach,

```js
 JSON.stringify(obj1) === JSON.stringify(obj2)
```

but before converting them to string we want the same order of keys, so we
used `sort_object_by_key` to sort `current_val` by keys and
`get_auth_method_table_data` always return `changed_val` having keys
sorted.

Since these refactor were closely related we kept them as a single commit
here.

Fixes: #11954.
2019-05-20 15:42:15 -07:00
Pragati Agrawal c634d22de9 org settings: Add `sort_obj_by_key` function to sort objects.
Actually, this is a preliminary commit which adds a general
`sort_obj_by_key` function to sort objects according to keys.

In this commit, we have refactored `populate_auth_methods` function by
extracting the logic for the desired `sort_obj_by_key` and used that to
sort `auth_methods`, but the main motive of this function is to sort
`realm_authentication_methods` in `check_property_changed` to sort
`current_val` in the upcoming commit.
2019-05-20 15:41:45 -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
Yashashvi Dave cb85ca8601 models: Alter video_chat_provider field type to integer.
Migration rewritten by tabbott because it did not work.
2019-05-13 12:02:28 -07:00
Puneeth Chaganti 4383c819cf digest: Fix visibility toggling of digest notifications checkbox. 2019-05-10 09:08:02 -07:00
Puneeth Chaganti b016ab257e digest: Toggle display of digest weekday setting dynamically.
Hide or show the digest weekday setting, based on whether
`digest_emails_enabled` flag is turned on or off.
2019-05-08 14:39:12 -07:00
David Wood f53a8f8bb6 settings: Rename `create_stream_permission` in templates.
This commit renames the `create_stream_permission` field in the
templates to `create_stream_policy`, matching the field used in the
database model. This matches what `invite_to_stream_policy` does and
will be clearer when the `waiting_period_threshold` is split into its
own field.
2019-05-06 16:30:01 -07:00
David Wood 34d810aac3 settings: Migrate to create_stream_policy structure.
This commit replaces the `create_stream_by_admins_only` setting with a
new `create_stream_policy` setting, which mirroring the structure of
the existing `invite_to_stream_policy`.

This is important preparation for migrating the waiting period feature
to be its own independent setting.

Fixes #12236.
2019-05-06 16:27:55 -07:00
David Wood 272ed90685 settings: Create an explicit invite_to_stream_policy setting.
This commit creates a new organization setting that determines whether
a user can invite other users to streams. Previously this was linked
to the waiting period threshold, but this was both not documented and
overly limiting.

With significant tweaks by tabbott to change the database model to not
involve two threshhold fields, edit the tests, etc.

This requires follow-up work to make the create stream policy setting
work how this code implies it should.

Fixes #12042.
2019-04-29 17:11:28 -07:00
Puneeth Chaganti b0f485e95f org settings: Allow admins to enable or disable digest emails. 2019-04-27 15:20:41 -07:00
Tim Abbott 7da28600c7 settings_org: Fix linter error with ==.
Apparently this was fixed in a later commit.
2019-04-26 22:48:03 -07:00
Pragati Agrawal f9681c1f51 org settings: Remove redundant loading indicator from auth methods table.
Number of auth methods isn't much, so no need to have loading indicator
here.
2019-04-26 17:57:04 -07:00
Pragati Agrawal d0ba0c7409 org settings: Add generalised function for tip-box for org settings.
This commit adds a `insert_tip_box` function and thus adds a
`organization-settings-tip` handlebars file to add a genaralised tip for
all organization settings pages. This further removes the code for tipbox
which was added in `populate_auth_methods` functions, as it wasn't making
sense there, making it more clear and readable.
2019-04-26 17:54:58 -07:00
Pragati Agrawal 2277ee0c90 org settings: Move `disable` attribute to `admin_auth_methods_list`.
This commits disables the auth-methods table using the disabled attribute
in admin_auth_methods_list handlebars instead of doing that in
settings_org.
2019-04-26 17:52:19 -07:00
Pragati Agrawal 75fc19acfd org_settings: Refactor `get_subsection_property_elements` function.
This commit adds a class prop-element for all the property elements, so
that later on we can directly use this to access elements.

In `get_subsection_property_elements`, we were finding these elements using
a makeshift method, where we were finding all these elements by mentioning
all input elements, textarea, select elements, which is not a desirable
method.
So now, here in `get_subsection_property_elements` function, we are finding
these properties using the newly added class `prop-element` which makes
code more clear and readable.
2019-04-26 17:52:19 -07:00
Pragati Agrawal 3dd5e1642b org_settings: Fix data collection of message retention property.
In handlebars and settings_org.js, the subsection in which
`realm_message_retention_days` property lies doesn't agree, and this wasn't
observed for a long time as it's disabled, still to make things right, in
this commit we have moved the logic which handles the collection of data
from `other_permission` to `other_settings` as it makes more sense there.
2019-04-26 17:41:01 -07:00
Pragati Agrawal ed30f71e07 org_settings: Remove redundant success_continuation variable.
This removes all the instances of `success_continuation` from settings_org
and accordingly refactors some code.
2019-04-26 17:41:01 -07:00
Ben Muschol d526ff00f2 settings: Rename "user avatar" to "profile picture"
This renames references to user avatars, bot avatars, or organization
icons to profile pictures. The string in the UI are updated,
in addition to the help files, comments, and documentation. Actual
variable/function names, changelog entries, routes, and s3 buckets are
left as-is in order to avoid introducing bugs.

Fixes #11824.
2019-03-15 13:29:56 -07:00
Pragati Agrawal 2ccf5655da realm_logo: Refactor `build_realm_logo_widget` function.
As a follow up of commit (bf1c9420df), this
commit removes the `build_realm_day_mode_logo_widget` and
`build_realm_night_mode_logo_widget` function , and changes
`build_realm_logo_widget` to take single argument `is_night` and depending
on this argument, corresponding `day mode` or `night_mode` widget is
handled.
2019-03-14 17:05:22 -07:00
Pragati Agrawal e630dde240 settings_org: Improve robustness of organization settings.
This moves the configuration of widget type from settings_org to instead
live in respective HTML templates, via `data-widget-setting-type` and we
also remove `get_subsection_property_types` and refactor function
`populate_data_for_request` accordingly.

Fixes: #11708.
2019-03-11 10:58:15 -07:00
Pragati Agrawal 36fcb67812 settings_org: Fix visibility time of `Saved` state.
This fixes the bug where the `Saved` state button faded out almost
instantly (that is actually 300 ms) and `Discard` button fades out
along with `Saved` state button; the key problem here was that the
setTimeout intended to fade was actually delaying the transition from
"saving" to "saved".

Now, first of all, we use `setTimeOut` function to fadeout elements giving
fadeout_delay time as `800 ms` and we hide discard button during `saving`
state. Also, when `Discard` button is selected, `Save changes` and `Dicard`
fade out simultaneously.

Fixes: #11737.
2019-03-10 13:08:57 -07:00
Pragati Agrawal 6a159b5743 settings_org: Refactor `change_save_button_state` function.
This makes the `change_save_button_state` funtion more clear and readable
by removing too many occurences of `.find()` and `.attr()` function.
2019-03-10 13:07:48 -07:00
Pragati Agrawal bf1c9420df org_settings: Refactor `build_realm_logo_widget` function.
This commit deduplicates the code for `build_realm_logo_widget` and
`build_realm_night_logo_widget`. It deduplicates the common code for
`build_realm_day_mode_logo_widget` & `build_realm_night_mode_logo_widget`
into tthe function `build_realm_logo_widget`.
2019-03-07 12:12:00 -08:00
Tim Abbott ab95704d2d settings: Fix mismatch of templates with JavaScript.
The alignment between the "Organization settings" code/labels and the
actual logic was broken in 65f6bea7d7
and the related commits.
2019-02-27 16:18:36 -08:00
sahil839 7157edf4af settings: Add support for uploading logo for night mode.
This adds a new field named realm_night_logo which is used for
displaying the organization logo when the user is in night mode.

Fixes #11176.
2019-02-18 15:15:57 -08:00
Pragati Agrawal 1e811b42ec org settings: Add realm level setting for missed message content in email.
This adds a setting under "Notification" section of
"Organization settings" tab, which enables Organization administrator to
control whether the missed message emails include the message content or
not.

Fixes: #11123.
2019-01-25 14:34:10 -08:00
Harshit Bansal d5fc02557c settings_org: Fix an incorrect jquery selector. 2019-01-13 08:17:30 +00:00
Steve Howell 82e453d9fe ui: Fix scrollbar regressions.
In between releases, the following commit introduced
a bug where we agressively scroll to the top every
place we call `ui.update_scrollbar`:

    092b73d0b7

The main symptoms were that the left and right sidebars
would go to the top for things like selecting a topic,
getting activity updates from the server, and resizing
the window.  It was very jarring.

The recent commit looked innocuous--the root of the problem
was the original API expressed an intent to scroll to the
top, but didn't actually do it, so it was a bug in hiding.

There are **some** occasions where it's actually appropriate
to scroll to the top, mostly around search filtering, and
in those places we now call the new `ui.reset_scrollbar`
function.

This is a bit of an emergency fix, so particularly with
the settings stuff, we may get more reports of glitches here.

The important thing here is that you almost never want to
reset the scrollTop for sidebars.
2019-01-09 09:15:45 -08:00
Marco Burstein 9ddadd39f4 compose: Add support for using Zoom as the video chat provider.
This adds Zoom call properties to the `Realm` model, creates endpoints
for creating calls, adds a frontend and tests.

Fixes #10979.
2019-01-07 10:00:02 -08:00
Joshua Pan ad1df0ebeb settings: Add support for customizing the top-left logo.
This adds a new realm_logo field, which is a horizontal-format logo to
be displayed in the top-left corner of the webapp, and any other
places where we might want a wide-format branding of the organization.

Tweaked significantly by tabbott to rebase, fix styling, etc.

Fixing the styling of this feature's loading indicator caused me to
notice the loading indicator for the realm_icon feature was also ugly,
so I fixed that too.

Fixes #7995.
2018-12-18 12:44:52 -08:00
Tim Abbott bdb3da4504 eslint: Add key-spacing linter rule.
Apparently, we didn't have one of these, and thus had a moderate
number of generally very old violations in the codebase.  Fix this and
clear the ones that exist..
2018-12-18 10:41:06 -08:00
Steve Howell 0543e8fbc1 settings: Call maybe_disable_widgets() in set_up() methods.
We now rely on set_up() methods to call their
own module-specific versions of maybe_disable_widgets()
in the codepath for admin_sections.load_admin_section().

And then for live updates, we just explicitly call
all four modules that support maybe_disable_widgets().

This should make switching between sections slightly faster,
and it also reduces the risk of module A messing with
module B's state.  (Granted, we have lots of other ways
that modules can mess with each other's state.)
2018-12-17 10:13:18 -08:00
Steve Howell b88a5700f6 settings: Extract multiple versions of maybe_disable_widgets(). 2018-12-17 10:13:16 -08:00
Tim Abbott 838dd6d273 lint: Add eslint enforcement for comma-spacing.
We've been enforcing this manually for a long time, and hadn't
realized it was missing from our eslint configuration.
2018-12-07 12:22:24 -08:00
Joshua Pan 67f0b1bbca admin: Add UI for editing realm_email_address_visibility.
This new setting is still hidden in the UI when not in the development
environment, because the feature isn't ready for production, but
merging this will help simplify future work on the feature.
2018-12-06 16:01:09 -08:00