Commit Graph

6524 Commits

Author SHA1 Message Date
Aman Agrawal 370d1b6ca7 recent-topics: Handle topic and topic's stream edit updates.
* Implementation and logic similar to recent_sender.process_topic_edit.
2020-05-20 09:44:50 -07:00
Aman Agrawal 04cdc89681 recent_topics: Handle mute/unmute update to topic.
* We don't remove topic data when it's muted. We will filter it
before rendering.
2020-05-20 09:44:50 -07:00
Aman Agrawal 76b0c6de86 recent-topics: Add module.
Add methods to extract recent topics from received messages.
Process new messages as they are received.
Use new messages received from the server to extract recent_topics.
Node tests added.
2020-05-20 09:44:50 -07:00
Rohitt Vashishtha 96638f5bd4 dropdown-list-widget: Use null-value when no value is specified.
Previously, we tried to read the value from page_params, which was just
a hack to make the calling code look cleaner. We now remove that hack
and thus, our dependency on page_params existing. Now, if the caller
does not specify a default value, we'll use the null-value.

This also creates a new init() function to cleanly wrap the code that
makes changes to the opts passed to the widget.
2020-05-19 15:13:28 -07:00
Rohitt Vashishtha aeb247f528 dropdown-list-widget: Rename setting_name -> widget_name.
This change is another in a series of commits that allows us to use
DLW outside of realm_settings.
2020-05-19 15:13:28 -07:00
Siddharth Varshney 0af2f9d838 popover: Hide color palette.
Change in stream color occurs very rarely, and the palette is taking a lot of space in the popover.

This commit will hide the palette in default view of stream popover.
2020-05-19 14:03:35 -07:00
Tim Abbott b746e0220b narrow: Add a block comment for narrow.activate. 2020-05-19 10:47:52 -07:00
Rohitt Vashishtha c70eb8b772 settings_bots: Do not destroy section when switching to users section.
We were destroying the bots table in start_data_load() which is now
only called for the users section since the refactoring done in
5c16bb9c99.
2020-05-18 17:02:00 -04: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 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
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
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
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
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
Steve Howell 393551bf81 bot settings: Live-update w/owner name (not email).
This fixes the fact that we update the bot table
with the owner's email instead of a name, but as
the TODO indicates, this is not a full fix, since
I don't linkify the owner name.

To do the full fix properly, I want to make it
so that the `list_render` widgets can just be given
an id of a row to update, and that's coming soon,
hopefully.  If I get sidetracked, the ugly ways to
do this are one of the following:

    - just duplicate what the template does in
      jQuery

    - extract a partial to draw the bot owner link

The full solution here should fix ALL the live
update code in `update_user_data`, which is why
I'm hesitant to add any interim complexity.
2020-05-11 16:14:04 -07:00
Steve Howell 47f07eeb2e minor: Move update_user_data() down in file.
This is just a lexical change.  We are going
to use some shared code soon that we don't want
to export, and if `update_user_data()` is
declared too early in the file, then the function
we extract will either need to be exported (to
satisy the linter) or placed far away from its
most natural siblings.
2020-05-11 16:14:04 -07:00
Steve Howell 91fa64e8e6 refactor: Extract `bot_owner_full_name`.
We will use this for a patch to the live-update
code, and it also de-clutters `bot_info`.

This function could plausibly live in `people.js`,
but it's not worth the indirection at this time,
and, also, one of the upcoming callers to the
function will only temporarily need it.

There's a little bit of a chicken/egg problem
going on:

    - It's hard to have nice system-wide
      APIs related to bots while bot settings
      are still in flux.

    - It's hard to clean up the bot settings
      code while the system-wide API is still
      kinda messy.

But I'm making slow progress on that front.
2020-05-11 16:14:04 -07:00
Steve Howell c8fd4e01e1 minor: Remove obsolete `is_active_human`. 2020-05-11 16:14:04 -07:00
Rohitt Vashishtha 6baf95d88a settings: Expose update function from settings_list_widget. 2020-05-11 14:00:05 -07:00
Rohitt Vashishtha b066ba1ff3 settings: Remove settings_org dependency from settings_list_widget.
Instead of taking a subsection option and calling the settings_org
function to update that subsection, we now take a callback function
as on_update. Also, we now store the value initial value of the
widget in opts.value instead of reading again from page_params.

These changes allow us to use this widget outside of settings_org
and for values other than settings that are in page_params.
2020-05-11 14:00:05 -07:00
Steve Howell 7c1f64d4e5 bot_data: Remove get_bot_owner_email. 2020-05-10 16:20:41 -04:00
Anders Kaseorg 78c70b1424 bugdown: Leave link titles alone until clean_user_content_links.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-09 16:32:40 -07:00
Anders Kaseorg 83a0006602 clean_user_content_links: Show the full URL in the title.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-09 16:32:40 -07:00
Steve Howell 2df183142c user settings: Flatten template data.
We now no longer have to remember that
`is_guest` is on `user` but `is_current_user`
is in `..`.

And we no longer have to remember that
`full_name` is on `user` but `display_email`
is in `..`.
2020-05-09 10:41:14 -07:00
Steve Howell 71c2bde665 user settings: Extract human_info(). 2020-05-09 10:41:14 -07:00
Steve Howell e9298dab5b bot settings: Extract bot_info().
We now gather all the bot info in one place, rather
than grabbing some of it during the triage phase and
then some of it later.

We also explicitly copy over the fields that we
need for the template, in preparation for two
efforts:

    - We want to get data from `people.js` and
      avoid the round trip to `<server>/json/users`.

    - We want to simplify the template by
      flattening our data.  (It's really somewhat
      arbitrary whether `is_admin` is a calculated
      value, for example, but we currently leak
      that implementation detail to the template.)

We can't flatten this data quite yet, since we
share the same template for bot users as human users,
so we'll fix the human data in a bit.
2020-05-09 10:41:14 -07:00
Steve Howell d45f0171cb user settings: Avoid status_field confusion.
We now close on status_field in our event handlers,
so that there's no chance of writing to the wrong
status field if somebody switches panels before
we have a status to report.

We can't eliminate `get_status_field` yet, but that
will go away in a future commit.
2020-05-09 10:41:14 -07:00
Steve Howell 8508cb6058 user settings: Clean up event handler code.
We now create the event handlers directly in
`set_up()`, and we explicitly tie them to
each of the three tables.

The goal here is to allow us to set up
the three tables individually, and this gets
us closer to that goal.
2020-05-09 10:41:14 -07:00
Steve Howell 772d7fa705 user settings: Improve deactivation-confirm code.
We are now more rigorous about only showing one
modal, only having one handler active, and not
needing to pull info out of the DOM.
2020-05-09 10:41:14 -07:00
Steve Howell fd3d7fa9f2 user settings: Move get_human_profile_data().
This is a purely lexical move (apart from changing
a closure variable to an argument), which is
simply designed to make less indentation for the
reader and to de-clutter `handle_human_form`.
2020-05-09 10:41:13 -07:00
Steve Howell f3e425c071 user settings: Build profile fields in open_human_form. 2020-05-09 10:22:37 -07:00
Steve Howell 79c25f40ce minor: Use person.full_name directly.
The get_full_name() helper is overkill when
we already have the `person` object, and the
surrounding code is already referencing fields
directly.
2020-05-09 10:22:37 -07:00
Steve Howell d5cadbcec2 user settings: Separate code for bot form.
When editing a bot, there are only two fields
that are similar to humans--full name and
email--which are trivial.

Before this commit we used a single codepath
to build the human form and the bot form.

Now we have two simple codepaths.

The tricky nature of the code had already led
to ugly things for the bot codepath that
fortunately weren't user facing, but which
were distracting:

    - For bots we would needlessly set things
      like is_admin, is_guest in the template
      data.

    - For bots we would needlessly try to update
      custom profile fields.

The code that differs between bots and humans
is nontrivial, and the code was both hard to read
and hard to improve:

    - Humans don't have bot owners.

    - Bots don't have custom profile fields.

The bot-owner code is nontrivial for performance
reasons.  In a big realm there are tens of thousands
of potential bot owners.  We avoid the most egregious
performance problems (i.e we don't have multiple
copies of the dropdown), but we may still want
to refine that (at least adding a spinner).

The custom-profile-fields code is nontrivial due
to the dynamic nature of custom profile fields,
which can bring in specialized widgets like
pill fields.

Now each form corresponds to a single endpoint:

    * human -> /json/users
    * bot -> /json/bots

Before we had a lot of conditional logic in
the template, the code to build to views, and
the code to submit the data.  Now everything is
much flatter.

The human code is still a bit messy (more work
coming on that), but the bot code is fairly
pristine.  All three components of the bot code
fit on a page, and there are no conditionals:

    - admin_bot_form.hbs
    - open_bot_form
    - handle_bot_form

We may want to grow out the bot code a bit
to allow admins to do more things, such as
adding services, and this will be easier now.
It would also be easier for us now to share
widgets with the per-user bot settings.

Note that the form for editing human data will
continue to be invoked from two panels:

    - Users
    - Deactivated users

There are some minor differences between
users and deactivated users, but the shape of
the data is the same for both, so that's still
all one codepath.

We eliminate `reset_edit_user` here, since
it was never used.

One nice thing about these forms was that they
had very little custom CSS attached to them
(at form-level specificity), and it turned out
all the custom CSS was for the human-specific
form.
2020-05-09 10:22:37 -07:00
Steve Howell f2ee1a1a65 user settings: Extract handle_* helpers.
This is purely refactoring.

The new call tree is:

    on_load_success
        populate_users
        handle_deactivation
        handle_reactivation
        handle_user_form
        handle_bot_owner_profile
        handle_bot_deactivation

The actual sequence of operations should be
identical to before.
2020-05-09 10:22:37 -07:00
Steve Howell 56517788fb user settings: Extract section.*.create_table(). 2020-05-09 10:22:37 -07:00
Steve Howell 2272c5e6eb modals: Use selectors for open_modal/close_modal.
When reading the calling code, it's helpful to know
that we're really just passing in a selector.  The
calls to open_modal/close_modal are nicer now to
reconcile with surrounding code, and you don't have
to guess whether the parameter is some kind of
"key" value--it really just refers directly to a DOM
element.

There is nothing user-visible about this change, but
the blueslip info messages now include the hash:

    open modal: open #change_email_modal
2020-05-09 10:22:37 -07:00
Steve Howell d3aded2ae7 drafts: Rename open_modal -> open_overlay.
We consider the drafts thing to be an overlay,
not a modal, so the old name was confusing.
2020-05-09 10:18:59 -04:00
Aman Agrawal 0c2b25cab3 home/page_params: Add suffix `_mib` to clarify the size units.
The docs say "megabytes" or "MB", but client software needs to
know the actual meaning, which is in mebibytes.
2020-05-08 14:54:54 -07:00
Pragati Agrawal bd9b74436c org settings: Enable message_retention_days in org settings UI.
Since production testing of `message_retention_days` is finished, we can
enable this feature in the organization settings page. We already had this
setting in frontend but it was bit rotten and not rendered in templates.

Here we replaced our past text-input based setting with a
dropdown-with-text-input setting approach which is more consistent with our
existing UI.

Along with frontend changes, we also incorporated a backend change to
handle making retention period forever. This change introduces a new
convertor `to_positive_or_allowed_int` which only allows positive integers
and an allowed value for settings like `message_retention_days` which can
be a positive integer or has the value `Realm.RETAIN_MESSAGE_FOREVER` when
we change the setting to retain message forever.

This change made `to_not_negative_int_or_none` redundant so removed it as
well.

Fixes: #14854
2020-05-08 14:09:31 -07:00
Pragati Agrawal 12504075ee org settings: Rename plan_includes_wide_organization_logo to more generic.
It's a preliminary step to enable message_retention_setting in org settings
UI, which is a non-limited plan only feature. So we require a page_param
property that tells us the limited-plan state of the Zulip realm.
2020-05-08 14:04:21 -07:00
Pragati Agrawal adb41b2e62 org settings: Use `get_input_element_value` in `check_property_changed`.
Logic to find the element value was duplicated in check_property_changed,
which can be replaced by `get_input_element_value`.
2020-05-08 14:04:21 -07:00
Pragati Agrawal fd9b868635 org settings: Use standard "types" in `.get_input_element_value()`.
The reason is to make the hardcoded property type values consistent with
`typeof` operator.
2020-05-08 14:04:21 -07:00
Pragati Agrawal 4eac4542e8 org settings: Return `undefined` in get_input_element_value.
This change makes `.get_input_element_value()` return a `undefined` instead
of `null` when `input_type` is not defined. Which also make sense
logically, as

> null: absence of value for a variable;

> undefined: absence of variable itself;

Source: https://stackoverflow.com/q/5076944/7418550
2020-05-08 14:04:21 -07:00
Tim Abbott e2e0039ffe settings: Expose UI for limiting optional invitations to admins.
This option case is important both for cleaning the UI when
invitations as not required, as well as for some policy situations.

Partially fixes #14859.
2020-05-08 11:09:21 -07:00
Anders Kaseorg b079ba97ff desktop-login: Fix window.open invocation.
window.open expects a string, not a URL object.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-06 13:57:07 -07:00
Steve Howell b46c8d1dc3 typeahead: Avoid tracebacks due to navbar changes.
In our recent navbar changes, we made it so that the
Esc key auto-closed the navbar. Unfortunately,
that code would break other typeaheads with a traceback.

One user-facing symptom was that if you drafted a PM
and started a typeahead on a recipient, then hitting
the Esc key wouldn't close the typeahead.

Now we use an `on_escape` mechanism that is specific
to the navbar typeahead, so that it's both generic and
harder to break for widgets that don't opt in to it.

See bbdc66a214 for
more details on the commit that introduced this
regression.

Note that I only call `tab_bar.exit_search` now.
I don't check the class name of the input element,
since I know that the Esc key is happening in the
context of search.  And I don't blur the input,
since it's going to be hidden.
2020-05-06 13:25:49 -07:00
Steve Howell 026474921a todo widget: Downgrade error to warning.
We were creating errors for task keys that were
from older versions of the widget.  We don't migrate
data for the widgets yet (they're all still considered
to be somewhat beta); instead, we just drop bad data
on the floor.

Rohitt and I re-tested the widget on czo pretty
extensively to verify that these errors don't show
up for newly created widgets.
2020-05-06 09:35:04 -04:00
sahil839 435e231567 click_handlers: Remove click handler for closing stream settings.
The click handler for closing stream settings in click_handlers.js
is removed as overlays.js contains common logic for closing all
overlays.

'exports.close' in subs.js is removed and 'hashchange.exit_overlay'
is used in 'overlays.open_overlay' call.
2020-05-05 21:44:09 -07:00
Rohitt Vashishtha d5576217fe typeaheads: Show tip text for silent mentions.
This addition is prompted by the feedback and discussion at
https://chat.zulip.org/#narrow/stream/137-feedback/topic/silent.20mention.
2020-05-05 15:20:06 -07:00
Tim Abbott b9098a42d4 messages: Allow moving a topic to another stream.
This completes the implementation of support for moving a topic to
another stream by adding a basic UI for it.

Fixes #6427, which was previously the most-upvoted issue request in
Zulip.

There are likely to be a bunch of follow-up UI improvements on top of
this change to fully flesh out the feature.
2020-05-04 10:03:03 -07:00
Hashir Sarwar 55a8e7dff2 settings: Offer hiding presence info from other users.
For privacy-minded folks who don't want to leak the
information of whether they're online, this adds an
option to disable sending presence updates to other
users.

The new settings lies in the "Other notification
settings" section of the "Notification settings"
page, under a "Presence" subheading.

Closes #14798.
2020-05-02 15:09:05 -07:00
Hashir Sarwar 735785f985 stream_topic_history: Track the most recent message in streams.
This adds a way to keep track of max_message_id of a
stream and fetch it using the method get_max_message_id().

This will be useful for sorting streams by most recent
activity which will be implemented in the upcoming commit.

Essentially rewritten by tabbott to have a coherent tracking system,
and provide documentation.

Part of #10794.
2020-05-02 11:16:51 -07:00
jagansivam28 bbf5a5efed invitation: Make Member to see invitations sent by him/her.
Member of the org can able see list of invitations sent by him/her.
given permission for the member to revoke and resend the invitations
sent by him/her and added tests for test member can revoke and resend
the invitations only sent by him/her.

Fixes #14007.
2020-05-01 17:42:49 -07:00
Anders Kaseorg a552c2e5f9 auth: Use the clipboard instead of zulip:// for desktop auth flow.
This does not rely on the desktop app being able to register for the
zulip:// scheme (which is problematic with, for example, the AppImage
format).

It also is a better interface for managing changes to the system,
since the implementation exists almost entirely in the server/webapp
project.

This provides a smoother user experience, where the user doesn't need
to do the paste step, when combined with
https://github.com/zulip/zulip-desktop/pull/943.

Fixes #13613.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-04-30 16:45:00 -07:00
Pranav 41cdf11e16 settings_account: Remove redundant call to loading.make_indicator.
Previously, a spinner was created and this spinner element passed to
do_settings_change function, which also created a spinner, making the
first spinner creation useless. This commit removes the spinner creation
logic and just passes the element where the spinner is to be rendered.
2020-04-30 16:13:49 -07:00
Wyatt Hoodes 5a58b7c549 data exports: Keep deleted export in UI table.
It makes sense to keep a deleted export in the table,
along with the time of deletion, for auditing reasons.
2020-04-30 13:00:59 -07:00
Wyatt Hoodes 2204f33936 data exports: Switch to solely using a status column. 2020-04-30 13:00:59 -07:00
Wyatt Hoodes 82e7ad8e25 data exports: Handle pending and failed exports.
Prior to this change, there were reports of 500s in
production due to `export.extra_data` being a
Nonetype.  This was reproducible using the s3
backend in development when a row was created in
the `RealmAuditLog` table, but the export failed in
the `DeferredWorker`.  This left an entry lying
about that was never updated with an `extra_data`
field.

To fix this, we catch any exceptions in the
`DeferredWorker`, and then update `extra_data` to
encode the failure.  We also fix the fact that we
never updated the export UI table with pending exports.

These changes also negated the use for the somewhat
hacky `clear_success_banner` logic.
2020-04-30 13:00:59 -07:00
Wyatt Hoodes b913478b76 settings_exports: Replace clear_succes_banner logic.
ui_report.js already had the functionality we were
looking for.
2020-04-30 13:00:59 -07:00
Siddharth Varshney de47262518 sidebar: Rename classes for menu icons in sidebars. 2020-04-30 10:56:09 -07:00
Jagan 805ac2475b settings: Redesign edit bot form.
This removes the weird edit-bot sidebar, replacing it with a modal,
matching our edit-user widget (and various similar ones).

Fixes #13644 by removing the buggy code.
2020-04-28 23:08:45 -07:00
Hashir Sarwar 0cbb778af4 ui_init: Fix play button position on video thumbnails.
This fixes a jQuery bug that broke the postion of play
button on video thumbnails particularly when YouTube
images fetched from oembed are displayed.
2020-04-28 22:41:00 -07:00
Aman Agrawal cfe427b3f7 narrow: bugfix: Update stream list height after rendering completes.
When switching from Private Messages narrow to
All messages narrow, stream list max-height was not
correctly updated. Stream list max-height was calculated
 before new height were updated by browser for
All message narrow.

Inshort:
Stream list max-height was being updated before the browser could
render height for `#global_filters`. Calling resize after narrow
completes removes this issue.
2020-04-28 12:32:40 -07:00
Anders Kaseorg a6fee2f18e notifications: Use electron_bridge.new_notification when available.
This will eventually let us delete a bit of annoying compatibility
code from the desktop app’s injected JavaScript.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-26 23:02:05 -07:00
Anders Kaseorg 549ed3913c notifications: Use NotificationAPI for permission_state.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-26 23:02:05 -07:00
Anders Kaseorg f277eb022c notifications: Use addEventListener to register handlers.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-26 23:02:05 -07:00
Anders Kaseorg cb52f4d7fc notifications: Remove weird Firefox code.
Firefox’s notifications are fine, and iconUrl isn’t a thing.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-26 23:02:05 -07:00
Anders Kaseorg a16cddf84f notifications: Remove cancel_notification_object wrapper.
Running the close handler won’t break anything; it’s safe to delete
from a Map while iterating through it.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-26 23:02:05 -07:00
Anders Kaseorg 0b1c27192f notifications: Remove long-gone webkitNotifications draft API.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-26 23:02:05 -07:00
Anders Kaseorg 8138e06935 notifications: Add link for sending a test notification.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-26 23:02:05 -07:00
Anders Kaseorg e701f20861 electron_bridge: Use getter and setter interface to mutable properties.
This exists in all versions of the desktop app that we still support,
and will eventually let us delete a bit of annoying compatibility code
from the desktop app’s injected JavaScript.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-26 23:02:05 -07:00
clarammdantas 25c5856988 stream_edit: Remove unnacessary conditionals.
The condition was removed because in either case we
want to have the stream_row and not the sub/unsub
button, so we can always get the stream_row directly.
2020-04-26 22:42:38 -07:00
Steve Howell c11de1e3a7 user profile cards: Fix bug with deactivated user.
We had a user have problems with the user
profile menus that you get when you click
on either sender avatars or mention pills.

If a deactivated user had a long enough email
that we would normally want to un-hide the clipboard
icon for them, we would crash inside of
`init_email_clipboard`, because the icon isn't
there for them.  If the user didn't have the
console open to see the crash, the symptom
became that you would get multiple cards
visible and kind of "stuck".

I chose to fix this by just making the code
defensive with respect to the absence of the
icon, instead of short-circuiting it for
deactivated users.

It's a bit odd that we still have an element
matching `.user_email_popover` in the profile
card for deactivated users, since that element
doesn't actually include an email, but it instead
says "(This user has been deactivated)".  I
considered removing the class, but the CSS
that we use for emails kind of applies here
too.

Testing this is a kind of a pain, as you want
either long emails or to just temporarily hack
this condition to true:

    if (this.clientWidth < this.scrollWidth) {
        // ...
    }

And then test with a deactivated user, of course.

Fixes #14473
2020-04-26 11:12:45 -07:00
rebtung f7fbe3419f api: Improve consistency of reactions API.
Previously, the message and event APIs represented the user differently
for the same reaction data. To make this more consistent, I added a
user_id field to the reaction dict for both messages and events. I
updated the front end to use the user_id field rather than the user
dict. Lastly, I updated front end and back end tests that used user
info.

I primarily tested this by running my local Zulip build and
adding/removing reactions from messages.

Fixes #12049.
2020-04-26 10:35:55 -07:00
Steve Howell df57f8c006 list_render: Move sort functions to module scope.
Moving these to module scope makes it a little
easier to round out our test coverage, plus
it's a bit less clutter in the widget code.
2020-04-24 18:24:12 -04:00
Steve Howell f2ddd31fe6 list_render: Clean up filter-missing errors. 2020-04-24 10:50:08 -04:00
Steve Howell 059ad86967 list_render: Error if opts are missing.
The check here was too late, and it should
have given a blueslip error.  We obviously
don't expect these errors at runtime; this
is a convenience for developers creating
new widgets.
2020-04-24 10:50:08 -04:00
clarammdantas de28c8d238 streams: Correct spinner bug when subscribing.
When clicking on the tick to subscribe to a stream,
an error occurred while trying to find the spinner
location because there are two DOM elements with the
same class, sub_unsub_button, and this made the
selector get the subscribe/unsubscribe button instead
the correct stream_row, where the tick is.

We now check whether the tick or the subscribe/unsubscribe
button was clicked, and if it was the last one we make
sure the stream_row and not the button is being passed
to the sub_or_unsub function.
2020-04-23 17:31:31 -07:00