Commit Graph

1662 Commits

Author SHA1 Message Date
Abhishek-Balaji 852576db97 settings: Add preview while uploading custom emoji.
This adds a preview of the uploaded emoji image while uploading custom
emoji right below the upload form.

Modified upload_widget.build_widget() to take in the preview
span text and image. In case a parameter isn't passed
for preview text, it defaults to null and the snippets in
build_widgets() related to preview don't run.

Fixes #9229.

Styling tweaked by tabbott.
2020-04-08 14:42:46 -07:00
majordwarf 8ea3bfb927 todo_list: Fix list item indexing in race condition.
The todo_widget was using the using a counter to store the key value of
every task. This would cause assiging multiple tasks the same key value
in a race condition. To avoid this we make "sender_id" a part of the key
along with the counter.

Also the `key` now not being a integer value, we can't use it to find the
index of the task using it. Thus, a function is made that will find the
index of task whose key is sent by the user to strike.
2020-04-08 06:56:21 -04:00
Pranav 939223426b settings ui: Hide btns to modify organization profile pic for nonadmins.
Users are unable to modify organization's profile picture, but
disabled buttons for the same are being shown to the user on the
organization profile settings page. This commit removes those
buttons. The file realm-logo-widget.hbs renders those buttons only
if the user is an admin and realm_logo.js has been updated to allow
operations(like click) on the buttons only to admins.
2020-04-06 15:36:02 -07:00
Pranav d91d32adfc settings ui: Hide buttons to add/delete organization logo for nonadmins.
Users are unable to modify organization's logos, but disabled
buttons for the same are being shown to the user on the organization
settings page. This commit removes those buttons. The file
realm-logo-widget.hbs renders those buttons only if the user is an
admin and realm_logo.js has been updated to allow operations
(like click) on the buttons only to admins.
2020-04-06 15:36:02 -07:00
Vaibhav Raj Singh 379eed7159 org settings: Minor changes to link icons and documentation.
Changed `help` to `help_link` so as to denote that it's a link to docs.
Also, updated `message feed` to `other settings` in docs.
2020-04-03 11:41:18 -07:00
MariaGkoulta b248b2681c settings: Add link for help near the setting of link previews
Next to the checkbox of "Show previews of linked websites" added a
documentation link in order to help users not confuse its function.
To do this:
- Added the field 'help' which is the link for the documentation in
organization_settings_admin.hbs
- Added the if statement in settings_checkbox.hbs to check if the above
field exists.In case it exists, a help icon which leads to the documentation
link appears.
The specific field was added in order to be able to add a help link in
other settings as well.

Co-authored-by: Katerina Perikou
<44238834+kPerikou@users.noreply.github.com>

Fixes: #13450
2020-04-02 17:38:24 -07:00
Pranav 957429e14a msg_recipient_bar: Add spacing between recipient_bar icons.
Fixes the problem of recipient_bar_icons being too close to each
other. To improve spacing between them, classes are added, namely
recipient_bar_icon_link (for link icon) and reciepient_bar_icon
(for other icons). CSS for spacing these classes correctly, using
padding-left and padding-right, has been added zulip.scss

Manually tested for cases with single and multiple links present.

Fixes #14364.
2020-04-02 17:08:44 -07:00
Ryan Rehman 39577b58ba stream settings: Display success/failure status for edits.
We have an alert for when the stream name is changed.
This also adds an alert when subscription settings
are updated and the widget is similar to that used in
the settings page.

This is also necessary because the stream specific
notification settings UI updation goes through this
path and it is necessary to display a confirmation
to match with other settings confirmation pattern.
2020-04-01 14:40:41 -07:00
Ryan Rehman c59997b148 templates: Extract subscription_privacy partial template. 2020-04-01 14:40:41 -07:00
Anders Kaseorg 68cfcd6446 CVE-2020-9444: Prevent reverse tabnabbing attacks.
While we could fix this issue by changing the markdown processor,
doing so is not a robust solution, because even a momentary bug in the
markdown processor could allow cached messages that do not follow our
security policy.

This change ensures that even if our markdown processor has bugs that
result in rendered content that does not properly follow our policy of
using rel="noopener noreferrer" on links, we'll still do something
reasonable.

Co-authored-by: Tim Abbott <tabbott@zulipchat.com>
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-01 14:01:45 -07:00
Ryan Rehman 9cb2475b53 notification_settings: Display streams that differ.
The user has an option for setting global
notification settings as well as the same settings
for individual streams. Currently the user has to
keep track of each unmatched stream and then visit
each individual stream whose settings he wants to
update.

Thus this adds a dedicated UI table allowing the user
to view and update the notifications of the specific
streams which differs from the global settings.
It is located on the same page where the user defined
global notification settings can be modified.

Fixes #9228.
2020-03-31 15:57:47 -07:00
majordwarf e85e598e56 bankruptcy: Migrate from modal view to top-of-page panel.
Switched to top-of-page prompt to make it natural to fit in with other
notifications. As we switch to panel-based prompt, templates for the
bankruptcy modal are moved along with its usage in application's
homepage.

We include a bit of delay before reloading to make it easy for the
user to read the "Marking all messages as read" banner before it is
covered by the "Reloading..." notice in environments where the reload
is fast.

Fixes #3347.
2020-03-31 15:30:37 -07:00
Anders Kaseorg 7ff9b22500 docs: Convert many http URLs to https.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-03-26 21:35:32 -07:00
Tim Abbott 19b806d6c2 settings: Fix notification settings update notifications.
This fixes the "Saving..." widget being on the wrong line.

Thanks to Shubham Dhama for the fix.
2020-03-26 11:45:07 -07:00
Puneeth Chaganti ca6cf9aeeb
stream settings: Allow tabbing to the input to add new subscribers.
Commit 68335d9124 removed the ability to tab
into this field, since it was a hidden field. This field is no longer
hidden, and this commit restores the ability to tab into it.
2020-03-26 11:31:15 -07:00
Pragati Agrawal dd13136371 settings: Migrate notification checkboxes to table format.
Here we have migrated checkboxes of all general notifications to the table.
By general notifications we mean, Mobile, Email, Desktop audio, and visual
notifications.

This is a part of a bigger migration to simply our notifications setting
changing infrastructure for all streams and individual streams. Later we
will add more row to this for different categories of notifications in
addition to the current ones ("Streams" and "PMs, mentions, alerts").

Fixes: #12182.
2020-03-25 17:45:59 -07:00
Steve Howell 697b00dd6e default streams: Change remove api to use stream_id.
This is a full-stack change:

    - server
    - JS code
    - templates

It's all pretty simple--just use stream_id instead
of stream_name.

I am 99% sure we don't document this API nor use it
in mobile, so it should be a safe change.
2020-03-25 17:11:25 -07:00
Pragati Agrawal 6fb438277e settings_notifications: Use single `.on()` instead of multiple `.click()`.
By this change we don't need to loop over each input element to attach the
handler, instead, we can use single `.on()` which takes care of changes.
2020-03-24 16:06:45 -07:00
Pragati Agrawal 0080499b08 settings_notifications: Use get_input_element_value for input values.
settings_org.get_input_element_value function returns values of input
elements in proper format based on their data-setting-widget-type.
2020-03-24 16:06:45 -07:00
Pragati Agrawal 53294928c4 settings: Fix toggling push notification checkbox when disabled.
We know that by default the value of `enable_stream_push_notifications` is
true, so on some server if push notifications are disabled then due to
```
{{#unless show_push_notifications_tooltip}}
```
the `enable_stream_push_notifications` checkbox is rendered as unchecked
and when we update any other setting in the "Stream notifications" section,
due to `settings_notifications.update_page()` all checkboxes are changed to
current values which means above checkbox get checked.

We can deal with this bug either making changes in
`settings_notifications.update_page()` but we should show check/uncheck
state of checkboxes anyway so removing this `unless` condition fixes this
bug.
2020-03-24 16:06:45 -07:00
Pragati Agrawal 83933034a4 settings: Simplify logic to show push notification tooltip in templates.
Instead of having logical expressions in templates, it's always preferred
to calculating them in javascript and pass the results as a context. It
also enhances the readability of templates and testing of such logic is
easier in js over templates.
2020-03-24 16:06:45 -07:00
Siddharth Varshney 328961a4fc settings: Reorganize options/sections in `Organization Permissions`.
As a consequence of too many options in the bottom `Other permissions`
subsection, the `Save` button could end up too far up from the bottom,
such that it might appear offscreen on low-height laptops.

We fix this by reorganizing the settings in a way that is both more
intuitive and also ensures that none of the subsections are too tall.

Fixes: #14274.
2020-03-24 10:36:40 -07:00
Siddharth Varshney 962684f189 ui: replace all mute icons from eye/eye-slash with bell/bell-slash.
eye/eye-slash icon is generally used for toggling hiding actions and we are using that same icon for mute action which can be a bit confusing
2020-03-22 12:31:48 -07:00
majordwarf 68dcdcd28e todo_list: Add task description and index numbers.
The user can pass description along with the task name by splitting the input string with hyphen.

Eg: Task Title - Task Description
todo_list: Add index numbers to task.
2020-03-12 08:02:06 -04:00
majordwarf ba2f11f78c todo_list: Render task name in bold text. 2020-03-12 08:02:06 -04:00
sahil839 6a791e1939 subscriber list: Fix display of email addresses in subscribers list.
Original email address is shown to admin users in subscriber list when
email_address_visibilty is set to "Admins only" by passing delivery_email
at required places.  Email address are not shown to non-admin users when
visibility is set to "Admins only".

Tweaked by tabbott to fix a few bugs and dead code.

Fixes a part of #13541.
2020-03-08 12:42:08 -07:00
Tim Abbott d0927d38fc streams: Use user IDs in membership list to track subscribers.
User IDs are more robust than email addresses as they don't change
with time, and also don't have complications with
different email_address_visibility settings.
2020-03-08 12:37:48 -07:00
Wyatt Hoodes a283d6e239 message_edit_form: Change topic editing default to `change_later`. 2020-02-27 11:30:11 -08:00
Anders Kaseorg 1cd1b5d198 settings_org: Convert time_limit_dropdown_values from object to Map.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-02-25 14:09:39 -08:00
Pragati Agrawal c68d90fea1 settings user groups: Fix organization admin can not create user groups.
The bug was in complex `if` condition, which should mean that users should
be allowed to create a User group only when they are either admin or user
group creation policy is set to everyone.

Fixes: #13909.
2020-02-24 12:12:52 -08:00
Ryan Rehman 5d7669e57e stream settings: Add links to /help/ for stream type settings. 2020-02-18 10:53:46 -08:00
Tim Abbott cd67c8305f i18n: Add missing translation tags to typing notifications.
Thanks to Andrea Soc for the report.
2020-02-12 10:54:34 -08:00
Tim Abbott b9853ac1bf subscription_type: Improve wording for full members case.
We have a consistent name for these that we use in documentation.
2020-02-04 17:14:28 -08:00
Ryan Rehman 174b2abcfd settings: Migrate to stream_post_policy structure.
This commit includes a new `stream_post_policy` setting,
by replacing the `is_announcement_only` field from the Stream model,
which is done by mirroring the structure of the existing
`create_stream_policy`.

It includes the necessary schema and database migrations to migrate
the is_announcement_only boolean field to stream_post_policy,
a smallPositiveInteger field similar to many other settings.

This change is done to allow organization administrators to restrict
new members from creating and posting to a stream. However, this does
not affect admins who are new members.

With many tweaks by tabbott to documentation under /help, etc.

Fixes #13616.
2020-02-04 17:08:08 -08:00
Vaibhav Raj Singh 3dec7f6f6f design: Fixes poor line wrapping of long stream names using ellipses.
Earlier, on narrowing the window to some particular sizes,
long stream names used to overlap with the subscribe and view stream
buttons.
The issue was resolved by cutting the stream name short and putting
ellipses at the end. A title was provided to the stream name div so that
the entire stream name would be visible on hovering over it.

Fixes: #13139
2020-02-02 21:34:00 -08:00
Vaibhav Raj Singh 1fa46b1963 compose: Improved warning for wildcard mentions.
Edited the warning to clearly state that most members/most stream members
will be notified on using wildcard mentions, along with the specific
mention (e.g. @ALL, @everyone and @stream).

Did a separate check for all wildcard mentions in util.js and stored the
corresponding mention in wildcard_mention inside compose.js.

Fixes: #13636
2020-01-31 12:24:35 -08:00
Pragati Agrawal 91a32fecbe settings_org: Use the actual value for private message policy options value.
This change is in series of de-duplication of code in "Other permission"
section for various dropdowns.

Here rather than using "by_anyone" and "disabled" for the `value` attribute
of options, we use actual numeric values. As a result, we don't need to
manually handle to extract the data to be sent to the backend on saving.
2020-01-31 12:42:26 +05:30
Pragati Agrawal 97e24e6e8a settings_org: Use actual value for user group edit policy dropdown options.
This change is in series of de-duplication of code in "Other permission"
section for various dropdowns.

Here rather than using "by_admins_only" and "by_admins_only" for `value`
attribute of options, we use actual numeric values. This helps in
de-duplicating lot of code which is vulnerable to bugs.
2020-01-31 12:42:26 +05:30
Pragati Agrawal ffc8042b59 settings_org: Use actual value for value attribute of invite stream policy.
This change is in series of de-duplication of code in "Other permission"
section for various dropdowns.
2020-01-31 12:42:26 +05:30
Pragati Agrawal 1420922705 settings_org: Use actual value for value attribute of create-stream-policy.
For few settings like `waiting_period_threshold` it makes sense to have the
"value" attribute of option to have a value other than the actual setting
value because multiple settings are depending upon this dropdown, so
handling them in JS code makes more sense. But for many settings (which has
integer values), we have followed a wrong trend over the time of
representing every new dropdown with human-readable values and manually
handling them in JS Code, where it makes more sense to use actual setting
value. The result of which is code has become less concise, sensible and
less likely to be mistaken.
2020-01-31 12:42:26 +05:30
Pragati Agrawal fad5c509ac settings_org: Extract the "options" code as template.
This is a preliminary commit for upcoming change where we will use
"bot_creation_policy_values" like approach for many other settings where
dropdown represents the only single setting of integer type.
2020-01-31 12:42:26 +05:30
Steve Howell eeee6edf41 pm_list: Simplify redraws for Private Messages.
We now use vdom-ish techniques to track the
list items for the pm list.  When we go to update
the list, we only re-render nodes whose data
has changed, with two exceptions:

    - Obviously, the first time we do a full render.
    - If the keys for the items have changed (i.e.
      a new node has come in or the order has changed),
      we just re-render the whole list.

If the keys are the same since the last re-render, we
only re-render individual items if their data has
changed.

Most of the new code is in these two modules:

    - pm_list_dom.js
    - vdom.js

We remove all of the code in pm_list.js that is
related to updating DOM with unread counts.

For presence updates, we are now *never*
re-rendering the whole list, since presence
updates only change individual line items and
don't affect the keys.  Instead, we just update
any changed elements in place.

The main thing that makes this all work is the
`update` method in `vdom`, which is totally generic
and essentially does a few simple jobs:

    - detect if keys are different
    - just render the whole ul as needed
    - for items that change, do the appropriate
      jQuery to update the item in place

Note that this code seems to play nice with simplebar.

Also, this code continues to use templates to render
the individual list items.

FWIW this code isn't radically different than list_render,
but it's got some key differences:

    - There are fewer bells and whistles in this code.
      Some of the stuff that list_render does is overkill
      for the PM list.

    - This code detects data changes.

Note that the vdom scheme is agnostic about templates;
it simply requires the child nodes to provide a render
method.  (This is similar to list_render, which is also
technically agnostic about rendering, but which also
does use templates in most cases.)

These fixes are somewhat related to #13605, but we
haven't gotten a solid repro on that issue, and
the scrolling issues there may be orthogonal to the
redraws.  But having fewer moving parts here should
help, and we won't get the rug pulled out from under
us on every presence update.

There are two possible extensions to this that are
somewhat overlapping in nature, but can be done
one a time.

    * We can do a deeper vdom approach here that
      gets us away from templates, and just have
      nodes write to an AST.  I have this on another
      branch, but it might be overkill.

    * We can avoid some redraws by detecting where
      keys are moving up and down.  I'm not completely
      sure we need it for the PM list.

If this gets merged, we may want to try similar
things for the stream list, which also does a fairly
complicated mixture of big-hammer re-renders and
surgical updates-in-place (with custom code).

BTW we have 100% line coverage for vdom.js.
2020-01-30 13:11:32 -08:00
Steve Howell 7cc344e554 topic list: Split out spinner template.
This is another prep step for making topic
list work via vdom.
2020-01-30 12:15:40 -08:00
Steve Howell ebf7e25732 stream list: Remove obsolete data-stream-name.
The last use case was for Casper tests.
2020-01-29 17:02:19 -08:00
Steve Howell 6948a768ec minor: Fix typo in template comment. 2020-01-29 17:01:19 -08:00
Steve Howell ca79648dd7 admin user: Remove obsolete data-email markup.
We mostly needed this for Casper tests, and that
usage was eliminated in the prior commit.

There was also some strange defensive code from
ecc42bc9f8 that
is really ancient and which I am eliminating:

    const email = row.attr("data-email");

    if ($("#deactivation_user_modal .email").html() !== email) {
        blueslip.error("User deactivation canceled due to non-matching fields.");
        ui_report.message(i18n.t("Deactivation encountered an error. Please reload and try again."),
                          $("#home-error"), 'alert-error');
    }

If the code was there to protect against live
updates for email changes, then we no longer
have to worry about that, since we use user_ids
now as keys.

Or it might have to do with some ancient bug
where you could pop open two modals at once
or something.  You can actually change users while
the modal is open (which is kinda strange, but ok),
and it works fine.

When testing this, I ran into the glitch that we
don't open redraw the Deactivated Users panel after
going into the User panel and deactivating a user.
2020-01-29 17:01:19 -08:00
Steve Howell b0cd7e02b6 stream create: Remove obsolete markup.
The only place we were using data-stream-name was
the Casper tests, which was fixed in the prior
commit.

And we don't need the value either.
2020-01-28 14:49:57 -08:00
Tim Abbott 0c0b446d43 templates: Reorder conditionals for stream_settings_checkbox.
This makes the template actually readable.
2020-01-28 14:26:53 -08:00
Tim Abbott b234c52699 templates: Wrap stream_settings_checkbox. 2020-01-28 14:23:47 -08:00
Pragati Agrawal b2c71b7cd8 stream edit: Move realm_setting_disabled in settings context.
Basic intention for this change is just to make code clean and intuitive.
2020-01-28 14:09:07 -08:00