Commit Graph

36087 Commits

Author SHA1 Message Date
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
arpit551 f3ab8e66dc ci: add configuration for posting to czo whenever CI fails in master.
Since notify is mostly depreciated  in the latest versions of CircleCI.
Although we can use use notify in CircleCI 2.0 but currently
there is no documentation regarding it.

We could have use notify here rather than this hacky solution but
if we use notify it was not possible to trigger CircleCI webhook only
for the main Zulip repository.

Also corrected the circle ci webhook for the case where we don't receive
previous in post request
2020-05-11 13:45:22 -07:00
Rohitt Vashishtha e065f51824 docs: Remove duplicate content from deploying-bots.md. 2020-05-11 13:42:22 -07:00
Rohitt Vashishtha 2ad55ef11b slack-import: Update docs to reflect the removal of Slack legacy tokens.
This commit deatails how users can generate the new type of APi tokens
by creating a new slack app with the correct scopes specified.

Fixes #14963.
2020-05-11 13:41:50 -07:00
Rohitt Vashishtha 9506be0f4f slack-import: Downgrade Slack legacy-token check failure to warning.
Slack has disabled creation of legacy tokens, which means we have to use other
tokens for importing the data. Thus, we shouldn't throw an error if the token
doesn't match the legacy token format.

Since we do not have any other validation for those tokens yet, we log a warning
but still try to continue with the import assuming that the token has the right
scopes.

See https://api.slack.com/changelog/2020-02-legacy-test-token-creation-to-retire.
2020-05-11 13:41:50 -07:00
Tim Abbott 937930cc90 integrations: Add bot avatar for grafana.
This was missed because the requirement to add these was new since the
original PR.
2020-05-11 01:07:44 -07:00
Tim Abbott d8ea649869 puppet: Cast tornado_processes to Integer.
This is the latest mechanism in puppet for turning a string into an
integer.

We update an adjacent comment while we're at it.
2020-05-11 00:54:48 -07:00
Tim Abbott 6319c181eb puppet: Use actual name for the bind9-host package.
Using the `host` virtual package confused Puppet into reporting it was
doing work every time one did a puppet run, resulting in unnecessarily
spammy output.
2020-05-11 00:51:53 -07:00
Mateusz Mandera dd40649e04 queue_processors: Remove the slow_queries queue.
While this functionality to post slow queries to a Zulip stream was
very useful in the early days of Zulip, when there were only a few
hundred accounts, it's long since been useless since (1) the total
request volume on larger Zulip servers run by Zulip developers, and
(2) other server operators don't want real-time notifications of slow
backend queries.  The right structure for this is just a log file.

We get rid of the queue and replace it with a "zulip.slow_queries"
logger, which will still log to /var/log/zulip/slow_queries.log for
ease of access to this information and propagate to the other logging
handlers.  Reducing the amount of queues is good for lowering zulip's
memory footprint and restart performance, since we run at least one
dedicated queue worker process for each one in most configurations.
2020-05-11 00:45:13 -07:00
Jenny Ghose 180c16c80e integrations: Add an incoming webhook for Grafana.
Tweaked by tabbott to use formatted suggested in one of the various
duplicate PRs for this issue, showing the rule name clearly.

Fixes #12951.
2020-05-11 00:27:38 -07:00
Tim Abbott a0c2121958 docs: Advertise Slack-compatible webhook a bit.
This should make it discoverable enough that users will try it out and
send us feedback.
2020-05-11 00:07:28 -07:00
Chris Heald c80e913c7a webhooks: Add a webhook capable of parsing Slack payloads.
This adds a webhook that can be used to interpret standard Slack
payloads. Since there are a ton of existing Slack integrations out
there, having a webhook which can accept standard Slack payloads can
significantly ease transition pains. Obviously this can't do everything
that Slack payloads can (particularly WRT their widgets/interactions),
but we can ingest text and parse out multi-block payloads into a message
relatively reasonably.
2020-05-11 00:07:28 -07:00
Tim Abbott 21a04e2dbc puppet: Use nice to deprioritize various processes.
Our priority hierarchy is:
(1) Tornado and base services like memcached, redis, etc.
(2) Django and message sender queue workers.
(3) Everything else.

Ideally, we'd have something a bit more fine-grained (e.g. some queue
workers are potentially in the sending path, while others aren't), but
this should have a big impact on ensuring Tornado gets the resources
it needs during load spikes.

I think this has a good chance of causing some load spikes that would
previously have resulted in a user-facing delivery delays no longer
having any significant user-facing impact.
2020-05-10 23:28:25 -07:00
Siddharth Varshney d1d012c1c4 desktop-login: Use zulip design styles for desktop-login.
Fixes: #14827
2020-05-10 23:05:19 -07:00
shubhamgupta2956 9cd8644c7c uploads: Add support for ".jpe" file extension.
Currently when the user uploads files with ".jpe" file extension, the
markdown is converted to link but the image is not embedded.

This commit adds the support for ".jpe" file extension.

Fixes #14863
2020-05-10 22:55:52 -07:00
Steve Howell 63154b335e bot_data test: Remove is_admin noise.
We no longer use `is_admin` in `bot_data`.
2020-05-10 16:20:41 -04:00
Steve Howell f9e2e357bf bot_data test: Clean up test people.
The prior version of "me" confusingly had the same
user_id as one of our bots, so I fixed that.

I also avoid using a test email of 'owner@zulip.com',
which is confusing for earlier tests where I haven't
established "me" as the actual owner of any bots.
2020-05-10 16:20:41 -04:00
Steve Howell 7c1f64d4e5 bot_data: Remove get_bot_owner_email. 2020-05-10 16:20:41 -04:00
Pragati Agrawal 60a762704a org settings: Fix limited plan realm can change message_retention_days.
These changes should be included in bd9b74436c,
as it makes sure that Zulip limited plan realm won't be able to change the
`message_retention_days` setting.
2020-05-09 16:40:50 -07: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
Anders Kaseorg 32f3fd1c77 bugdown: Fix ElementPair typing.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-09 16:32:40 -07:00
Anders Kaseorg 6aaeab75bc bugdown: Fix ResultWithFamily typing.
It needs to be a full class because a generic NamedTuple doesn’t work
in Python 3.6.

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
Tim Abbott 524d347c39 i18n: Fix makemessages not walking subdirectories.
Fixes an issue noticed in #14881.
2020-05-08 17:03:16 -07:00
Anders Kaseorg caf64585e4 lint: Disallow old-style type comments.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-08 16:42:43 -07:00
Anders Kaseorg 8cdf2801f7 python: Convert more variable type annotations to Python 3.6 style.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-08 16:42:43 -07:00
Anders Kaseorg 708c6f4f11 puppet: Finally vanquish the cursed integer conversion conditional.
We no longer support Puppet 3.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-08 16:42:43 -07:00
Anders Kaseorg 80caaaae65 circleci: Remove legacy check_xenial_puppet step.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-05-08 16:42:43 -07:00
Tim Abbott 200209995b test_signup: Update email content for last design tweak. 2020-05-08 15:18:21 -07:00
Puneeth Chaganti ded3b00760 home: Use last update_message_flags activity instead of pointer.
The pointer doesn't get updated when a user is only reading messages in
narrowed views. But, we use the pointer position to determine the
furthest read time, which causes the bankruptcy banner to show up even
for users who have been actively reading and sending messages.

This commit switches to using the time of the last update_message_flags
activity by a user to determine the time of last activity.
2020-05-08 15:06:06 -07:00
Puneeth Chaganti 1adb88cf62 home: Extract code to get the furthest read time. 2020-05-08 15:01:08 -07:00
Puneeth Chaganti a937ea531e test_home: Return message id when sending test message. 2020-05-08 15:01:08 -07:00
Aman Agrawal 898e717b9d register:api: Provide additional fields that can be useful to clients.
Fixes #14166

* Bumped the api version to feature level 4.
See https://github.com/zulip/zulip/issues/14166#issuecomment-598961462
for details about implementation and future steps.
2020-05-08 14:54:54 -07: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