Commit Graph

9644 Commits

Author SHA1 Message Date
Siddharth Varshney 2981938817 ui: Change width of divider in setting menu.
This will now matche with the other popover `hrule` width.
2020-05-16 15:42:26 -07:00
sahil839 46ef6816b6 stream: Allow non admins to set stream post policy when creating streams.
This commit allows non admins to set stream post policy while creating
streams.

Restriction was there to prevent user from creating a stream in which
the user cannot post himself but this will be taken care of with
stream admin feature.
2020-05-16 14:53:22 -07:00
Rohitt Vashishtha a6a1858272 dispatch: Replace broken call to settings_org.
We had removed this function from the codebase when we switched to
using dropdown_list_widget. This was accidentally left as it is when
making that change.
2020-05-16 14:51:19 -07:00
Aman Agrawal 40c2a82e4e
message_events: Update edited msgs to be rerendered together.
This significantly reduces the time required to handle events like
stream & topic name edit for topics.

Verified using the Chrome Profiler for a topic with 100 messages:
With this commit: 0.64s to move the topic to a different stream.
Without this commit: 5.5s.
2020-05-16 14:48:44 -07:00
clarammdantas 3b4c49e0e2 subs.js: Change how to check if the subscribed tab is active.
Before we used a selector to check whether the "Subscribed" tab
is active or not. The problem is that if a new sibling of the tab
switcher is inserted in the DOM and uses the same classes as the
"Subscribed" and "All Streams" button do, the selector can get
the sibling element instead the tab button.
To avoid that, we are using a variable that tracks the current
active tab instead of using the selector.
2020-05-14 23:24:23 -07:00
Aman Agrawal 27ee527bd6 topic_stream_edit_popover: Add right-angle icon. 2020-05-14 14:27:53 -07:00
Aman Agrawal d537ceef5a topic_stream_edit_popover: Add stream color bar before selet tag.
* The implementation is similar to message stream edit color bar.
2020-05-14 14:27:53 -07:00
Aman Agrawal 7c502acb4c message_edit: Show stream color bar alongside stream select.
* Stream bar color logic is borrwoed from compose stream bar.
* Use flex containers to align elements and automatically set their
  height to be same, them automatically filling the stream color bar
  height to be the height of the select box.
* Use flex-wrap to wrap the propagate selector when out of space.

* To make sure stream select box and stream color box are closest possible,
  select box has been moved under stream color box.
2020-05-14 14:27:53 -07:00
Aman Agrawal 9734bcc7cd compose_ui: Extract method to set color of stream header bar.
Similar method will be used to set color for stream selection bar
when editing stream of topic/message.
2020-05-14 14:27:53 -07:00
Gillian Pantaleon 7a943601bc messagebox: Add title-text for user profile on sender name and avatar.
A separate outer span with the title text needs to be added because:

(1) The default bootstrap popover behavior takes the title as the
popover title, if provided.
(2) We need to avoid having the title area be too big in the
me_message template.

Fixes #12769.

Co-Author-By: Vaibhav <vrongmeal@gmail.com>
2020-05-14 14:07:41 -07:00
João Maurício Carvalho 41afdc6526 compose.js: Fix compose box didn't collapse.
Fix a bug where the compose box didn't collapse when sending a message
from the preview area by hitting the send button. The bug ocurred because
the preview area wasn't being properly cleared when this flow was executed.
This was fixed by moving the clear_preview_area function call for a place
that will be reached by both the enter and button flow.

Fixes: #14889
2020-05-13 15:33:07 -07:00
Rohitt Vashishtha 6a3e245fe3 settings_org: Handle dropdown list widget updates inside module.
Previously, we handled these updates in server_events_dispatch
and could accidentally call widget.render() before initializing
the widget.

Original report: https://chat.zulip.org/#narrow/near/875608.

The sync_realm_settings function ensures that if the settings are
not open, any updates are a noop.
2020-05-13 10:08:51 -07:00
Rohitt Vashishtha e2b0a4cba1 list-widget: Rename settings_list_widget => dropdown_list_widget.
We want to use this widget outside of the settings panels as well.
2020-05-13 10:08:51 -07:00
majordwarf 587b5473c2 css: Use SCSS nesting in settings.scss for `input`. 2020-05-12 23:17:27 -07:00
majordwarf cd2cf1a1aa css: Reorder settings.scss for `input` and remove unused rulesets. 2020-05-12 23:17:27 -07:00
majordwarf 298d2c5a17 css: Use SCSS nesting in settings.scss for `.input-group`. 2020-05-12 23:17:27 -07:00
majordwarf 03a95cfe49 css: Use SCSS nesting in settings.scss for `.dynamic-input`. 2020-05-12 23:17:27 -07:00
majordwarf 1384050683 css: Use SCSS nesting for child elements of `.dynamic-input`. 2020-05-12 23:17:27 -07:00
majordwarf 5af7665b3c css: Reorder `.dynamic-input` to put next to each other. 2020-05-12 23:17:27 -07:00
majordwarf 6371f0109c Use: SCSS nesting in settings.scss for `.table` in `#admin-user-list`. 2020-05-12 23:17:27 -07:00
majordwarf 70ef0e9232 css: Use SCSS nesting in settings.scss for `.settings-info-icon`. 2020-05-12 23:17:27 -07:00
majordwarf 796d3c2e7f css: Use SCSS nesting in settings.scss for `#settings_content`. 2020-05-12 23:17:27 -07:00
majordwarf 806269fc40 css: Reorder `#settings_content` to put next to each other. 2020-05-12 23:17:27 -07:00
majordwarf f6b3aa4e8b css: Use SCSS nesting for avatar, logo and icon selectors. 2020-05-12 23:17:27 -07:00
majordwarf 8543750d43 css: Reorder avatar, logo and icon selection next to each other. 2020-05-12 23:17:27 -07:00
majordwarf cc21c45c7a css: Refactor `.inline-block` in settings.scss. 2020-05-12 23:17:27 -07:00
majordwarf 02516c6f69 css: Use SCSS nesting in settings.scss for `.user-avatar-selection`. 2020-05-12 23:17:27 -07:00
majordwarf 895945b165 css: Reorder `.user-avatar-selection` to put next to each other. 2020-05-12 23:17:27 -07:00
majordwarf aed2450cc0 css: Use SCSS nesting in settings.scss for `label`. 2020-05-12 23:17:27 -07:00
majordwarf bc6baa9f2b css: Reorder `label` next to put next to each other. 2020-05-12 23:17:27 -07:00
clarammdantas 77195f94c1 stream_settings: Don't remove stream_row if in "All Streams" tab.
If you were on "All Streams" tab and unsubscribed to a private
stream, that stream row would momentarily disappear. If you
click again on "All Streams" button, it would appear again.

The problem was that the selector was finding two elements
instead of just the tab element. To solve this we used a more
specific selector to make sure we are getting the Subscribed
tab only.
2020-05-12 14:14:13 -07:00
sahil839 2491bcdd84 realm_logo: Fix incorrect display of realm logo delete button.
This commit fixes the bug of incorrectly showing/hiding the
realm logo delete button by using realm_night_logo_source for
checking the source of night mode logo instead of previously
used realm_logo_source for both day and night logos.
2020-05-12 11:59:06 -07:00
Rohitt Vashishtha 12836d6f0a typeahead: Advertise default codeblock language. 2020-05-12 11:40:12 -07:00
clarammdantas 7e9024a39c popovers.js: Add version to user avatar request.
When a user changes its avatar image, the user's avatar in popovers
wasn't being correctly updated, because of browser caching of the
avatar image.  We added a version on the request to get the image in
the same format we use elsewhere, so the browser knows when to use the
cached image or to make a new request to the server.

Edited by Tim to preserve/fix sort orders in some tests, and update
zulip_feature_level.

Fixes: #14290
2020-05-12 11:09:01 -07:00
Rohitt Vashishtha a9b434b354 night-mode: Update CSS for navbar separators. 2020-05-12 00:16:09 -07:00
Tim Abbott 93a303db97 recent_senders: Use better variable names and comments.
This makes the data structures in use here more readable.
2020-05-12 00:15:26 -07:00
Aman Agrawal 5443b2f635 recent_senders: Update data structures for stream/topic edits.
* Remove old topic and reprocess both old and new topic to ensure
that we are correctly storing the last_msg_id of users in the
topic. Also, Handle topic's stream (& topic) edit updates.
* Add function to get all messages in a topic in message_utils.js.
* Send topic edit event to recent_senders.
* Add func get sorted list of recent_senders to topic.
The function will be useful to handle topic edits in Recent Topic UI.
2020-05-12 00:15:26 -07:00
Anders Kaseorg 4362cceffb portico: Add setting to put Google Analytics on selected portico pages.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-11 23:22:50 -07:00
Vishnu KS 8fb1f2af58 billing: Support downgrading plan from /billing page. 2020-05-11 17:20:54 -07:00
Vishnu KS f74e2b69f0 billing: Pass numeric_inputs as an argument to create_ajax_request. 2020-05-11 17:20:54 -07:00
Tim Abbott 5a67d10943 tab_bar: Don't set a title for the narrow_description.
The title field here was useless duplication of the text context.
2020-05-11 16:40:55 -07:00
YashRE42 7c820fa51e navbar: Fix handling of links in click handler.
This commits improves how we handle <a> tags within the navbar
description. The code previously overlaid click regions on top of each
other, which was messy and probably somehow buggy.

It is cleaner if we just check if the click was on an <a> tag or not.
2020-05-11 16:37:13 -07:00
Aman Agrawal 7197a7ac68 message_edit: Add support for changing stream of a message.
* This feature is currently only visible to admins.
* Locally echoed messages are also updated.
* Add UI for editing stream if user is admin.
* Show propagate mode selector if either stream or topic changed.
2020-05-11 16:25:47 -07:00
Steve Howell c4d0e4c9f9 bot_data: Eliminate all uses of `bot.owner` (email).
We now use `bot.owner_id` for everything internally.
2020-05-11 16:16:58 -07:00
Steve Howell 9f137c3a05 bots: Extract user_dropdown widget.
We use this new widget in bot settings panels
(personal and org).  It lets you re-assign a
bot to a new human user.

Ideally we can improve this code to use
our existing list widgets to make it more
performant for realms with lots of users.
2020-05-11 16:16:58 -07:00
Steve Howell 5c16bb9c99 bot settings: Load bots independently.
We no longer use `/json/users` in the codepath
for bot settings (admin side).

We also specifically don't load human users when
we load bots, so you no longer have to pay for
the server round trip as a side effect of loading
bots.  Instead, there is a dedicated `set_up_bots`
entry point.

We also get the bot ids directly from `bot_data` now.

This commit, to some degree, builds on the prior commit
that had us hydrate data from `people.js` instead
of the payload from `/json/users`.
2020-05-11 16:16:58 -07:00
Steve Howell f6b1176045 bot settings: Use `get_item` in the list widget.
Our `list_render` list widget gives us the
option to use ids as our "list" and then
hydrate that list on-demand with an
`opts.get_item` function.

We now use that for the bots list, passing
in `bot_info` as that option.

And, importantly, we are now actually
hydrating the bot data from `bot_data.js`
data structures, and not `/json/bots`.

Using the `get_item` scheme has a couple
benefits:

    - Our sort functions are based on the
      actual items that we use to build the
      template, so there's a bit less
      code duplication.  (Generally, the
      data that we pass in to the template
      is "finalized" in some sense, such
      as the bot owner name.)

    - We are less likely to display stale
      data.

    - We are less likely to wire up filters
      to intermediate data elements that are
      not actually displayed to users (think
      of email vs. delivery_email).

We do rely on `get_item` (i.e. `bot_info`)
to be inexpensive, which it should be.

Note that we haven't completely decoupled
ourselves from `/json/bots`, which we still
use as our source for bot user_ids.  We will
fix that in the next commit.
2020-05-11 16:16:58 -07:00
Steve Howell be064e6104 list_render: Add get_item option.
We want to move toward having list consumers
pass us in a list of ids that we hydrate later
in the process.  This should help live-update
scenarios.  The next commit will describe the
benefits in a bit more detail, using the
concrete example of our bot settings table
in the org settings.

A slightly longer-term goal here is to be
able to ask `list_render` to re-render a particular
id, and this moves us closer to that.  But even
before that, this change should eliminate a class
of bugs dealing with stale data, such as when
you manually patch a list (with direct jQuery
hacks) but then later go to sort/filter the rows.
We will now re-hydrate the items in those scenarios.
2020-05-11 16:16:58 -07:00
Steve Howell cea6214ce8 user settings: Remove reset/meta.loaded logic.
We don't really need to know whether we've loaded
the user-related panels, since we only used `meta.loaded`
for a tiny optimization to avoid a jQuery lookup.

We rely mostly on the list widgets from `list_render`,
and they are smart enough to repopulate themselves
when they're called subsequent times.
2020-05-11 16:16:58 -07:00
Steve Howell 155f6da8ba bots: Add owner_id to bot-related payloads.
For the below payloads we want `owner_id` instead
of `owner`, which we should deprecate.  (The
`owner` field is actually an email, which is
not a stable key.)

    page_params.realm_bots

    realm_bot/add

    realm_bot/update

IMPORTANT NOTE: Some of the data served in
these payloads is cached with the key
`bot_dicts_in_realm_cache_key`.

For page_params, we get the new field
via `get_owned_bot_dicts`.

For realm_bot/add, we modified
`created_bot_event`.

For realm_bot/update, we modified
`do_change_bot_owner`.

On the JS side, we no longer
look up the bot's owner directly in
`server_events_dispatch` when we get
a realm_bot/update event. Instead, we
delegate that job to `bot_data.js`.
I modified the tests accordingly.
2020-05-11 16:16:58 -07:00