Commit Graph

35722 Commits

Author SHA1 Message Date
Tim Abbott e1849b63c1 send_email: Use CommandError for user-facing command line errors.
This provides much nicer error output (not a traceback).
2020-04-18 13:30:03 -07:00
wowol 507f889901 send_custom_email: Add support for emailing all admins.
This provides a convenient way to send a custom email to just the
administrators of an organization.

Fixes part of #13413.
2020-04-18 13:27:30 -07:00
orientor 4100d4c19f openapi: Pass validation of zulip.yaml on openapi-generator.
The openapi-generator has an additional set of requirements for
validation. Make changes in zulip.yaml accordingly.
2020-04-18 13:17:52 -07:00
Anders Kaseorg a51902a870 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 13:17:01 -07:00
Anders Kaseorg 6f55a8b7e5 templates: Fix invalid self-closing tags.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 13:13:14 -07:00
Anders Kaseorg 11194873ca requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 13:09:51 -07:00
Anders Kaseorg d3c55c166e requirements: Upgrade mypy from 0.761 to 0.770.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 13:09:51 -07:00
Anders Kaseorg 8e93175822 requirements: Upgrade Python-Markdown from 3.1.1 to 3.2.1.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 13:09:51 -07:00
Anders Kaseorg ddcb828349 markdown: Match Python-Markdown code whitespace more closely in JS.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 13:09:51 -07:00
Anders Kaseorg 21c2a4cc42 update-locked-requirements: Generate prod locks from dev locks.
This guarantees that we don’t accidentally upgrade one without the
other, which could happen for example due to different third-party
version constraints between the two.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 13:09:51 -07:00
Aman Agrawal 09d6beecbe docs/wsl: Clone in ~/zulip to avoid permission issues. 2020-04-18 12:25:27 -07:00
Aman Agrawal bf2aec3ff3 docs/wsl: Correct name for rabbitmq conf file. 2020-04-18 12:25:27 -07:00
Anders Kaseorg d33abba687 base: Fix jinja2.exceptions.UndefinedError on Python ≥ 3.7.
Python 3.7 changed dict.update to avoid swallowing exceptions when
checking for the keys attribute (https://bugs.python.org/issue31572).
This broke {}.update(jinja2.Undefined()).

Fix it with an explicit default.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 05:35:51 -07:00
YashRE42 87ba6cb4c9 tab_bar: Fix colors stream_count and description in nightmode.
This fixes a bug which caused by removing an <li> based structure on
the navbar. We forgot to update these styles.
2020-04-17 14:49:39 -07:00
Tim Abbott a25b38cd0e i18n: Fix translated strings for topic-move notices.
These strings were improperly using positional string substitution,
which doesn't work with i18n for languages with a different word order.
2020-04-17 13:46:39 -07:00
YashRE42 bbdc66a214 typeahead: Close/open typeahead with searchbox.
The todo here is to ensure that we open and close the typeahead as
soon as the navbar search is opened/closed.
2020-04-17 13:37:04 -07:00
YashRE42 eb4a2b9d4e navbar: Improve structure & styling for top navbar.
This updates the logged-in top navbar to display the stream/message
name, number of users, and description. It also replaces the search
bar with a search icon that expands into a full-width search bar.

Co-authored-by: Max Nussenbaum <max@maxnuss.com>

Fixes: #164.
Fixes: #5198.
2020-04-17 13:35:44 -07:00
YashRE42 5fdb8989e5 filter: Use ', ' to separate names in PM title.
This is a prep commit for the navbar redesign.
2020-04-17 13:13:31 -07:00
Tim Abbott 497383cc12 stream_topic_history: Fix incorrectly migrated field name.
In ee0d4541b4, we renamed the topic_date
-> stream_topic_history, and in the process renamed some local object
properties from .name => .topic_name, and accidentally change the
type for the data from the server as well.

The test fixtures were incorrectly migrated in the same way, so we fix
that as well.
2020-04-17 13:11:27 -07:00
orientor 71ab86f5f7 openapi: Fix minor error in zulip.yaml 2020-04-17 12:49:01 -07:00
pemontto fd34bc5161
puppet: Allow /etc/zulip to be a symlink.
This PR updates the puppet manifest to allow /etc/zulip to be a symlink. The current behaviour overwrites /etc/zulip if it is link to another directory, which is problematic with docker-zulip and 
in particular the `LINK_SETTINGS_TO_DATA` setting.
2020-04-17 12:45:05 -07:00
orientor bcb8def308 openapi: Use serialized response codes instead of descriptive ones.
Openapi had descriptive response codes for endpoints with multiple
responses for same response code. But this does not fall in line
with openapi specifications. So change descriptive response codes
like "400_auth" and "400_anauth" to "400_0" and "400_1" for all
such endpoints. Also make the necessary changes in openapi.py so
as to be able to read the schema in such cases and generate example
in such cases.
2020-04-17 11:49:58 -07:00
orientor 1131d136f3 openapi: Make zulip.yaml pass validation on swagger editor.
zulip.yaml is not in compliance with openapi specifications file.
Edit it so that it passes verification as an openapi specification
file.

Fixes #14582 .
2020-04-17 11:49:58 -07:00
Jagan e5d6e2e44f settings UI: Fix hovering bug in "Uploaded files" settings.
While Hovering over some cell of the tables in settings Tab
increase the cell width since we are using the pseudo-Element `:: after`
the bug is fixed by adding `position: absolute;`.
fixes #14559
2020-04-17 11:35:31 -07:00
Divyanshu Agrawal 8a64ed6e20 alert words: Limit alert word length to 100.
We do limit the length to 100 in the frontend, but no such check
exists in the backend.

Check that a new alert word has a maximum length of 100 in the
alert_words endpoint.
2020-04-17 11:32:16 -07:00
Steve Howell c0af648b0c db checks: Remove options from database_exists().
The original commit had `options` without actually
using it:

    dbeab6aa6f

We still aren't using it, so I removed the needless
confusion.
2020-04-17 09:53:28 -07:00
Steve Howell 7eb6d32d59 provision: Let build_emoji build its own cache.
We no longer need to maintain duplicate code
related to where we set up the emoji
cache directory.

And we no longer need two extra steps for
people doing advanced (i.e. manual) setup.

There was no clear benefit to having provision
build the cache directory for `build_emoji`,
when it was easy to make `build_emoji` more
self-sufficient.  The `build_emoji` tool
was already importing the library that has
`run_as_root`, and it was already responsible
for 99% of the create-directory kind of tasks.

(We always call `build_emoji` unconditionally from
`provision`, so there's no rationale in terms
of avoiding startup time or something.)

ASIDE:

Its not completely clear to me why we need
to put this directory in "/srv", instead of
somewhere more local (like we already do for
Travis), but maybe it's just to be like
its siblings in "/srv":

    node_modules
    yarn.lock
    zulip-emoji-cache
    zulip-npm-cache
    zulip-py3-venv
    zulip-thumbor-venv
    zulip-venv-cache
    zulip-yarn

I guess the caches that we keep in var are
dev-only, although I think some of what's under
`zulip-emoji-cache` is also dev-only in nature?

    ./var/webpack-cache
    ./var/mypy-cache

In `docs/subsystems/emoji.md` we say this:

```
The `build_emoji` tool generates the set of files under
`static/generated/emoji` (or really, it generates the
`/srv/zulip-emoji-cache/<sha1>/emoji` tree, and
`static/generated/emoji` is a symlink to that tree;we do this in
order to cache old versions to make provisioning and production
deployments super fast in the common case that we haven't changed the
emoji tooling). [...]
```

I don't really understand that rationale for the development
case, since `static/generated` is as much ignored by `git` as
'/srv' is, without the complications of needing `sudo` to create it.

And in production, I'm not sure how much time we're really saving,
as it takes me about 1.4s to fully rebuild the cache in dev, not to
mention we're taking on upgrade risk by sharing files between versions.
2020-04-17 09:53:26 -07:00
Steve Howell bf3decfd0c build_emoji: Inline get_success_stamp.
So, `source_emoji_dump` is not the greatest variable
name, but at least we now define it relative to its
parent instead of the `.success-stamp` file.  (And
then `success_stamp` is just another join.)
2020-04-17 09:45:59 -07:00
Steve Howell aae28e41d0 provision: Extract create_var_directories().
This fixes the pattern of
SIX_DIR_PATH_CONSTANTS_IN_ALL_CAPS
just to create a few subdirectories.
2020-04-17 09:45:59 -07:00
Steve Howell bc62796276 provision: Check for compiled templates.
If the directory `templates/zerver/emails/compiled/`
is missing, then we need to run `inline_email_css`
again.

This can happen if somebody gets overzealous about
cleaning untracked files.
2020-04-17 09:45:59 -07:00
Steve Howell ec416a315f provision: Extract need_to_run_inline_email_css.
This extraction also prevents an unnecessary
call to `glob.glob` when `is_force` is `True`.
2020-04-17 09:45:59 -07:00
Steve Howell 66234850ba provision: Extract need_to_run_build_pygments_data.
This is more encapsulated and more efficient.

In the cases where `is_force` is `True` or
`pygments_data.json` is missing, we now avoid
the unnecessary step of importing `pygments`, at
least up front.

(Of course, we probably import that once we generate
the artifacts.)
2020-04-17 09:45:59 -07:00
Steve Howell 796351ed9e provision: Detect missing language_name_map.json.
If somebody is having issues with provision, it's
plausible they'll do something like `git clean -fX`
to clean up old artifacts of earlier provision runs,
as part of debugging things.

We defend against this by detecting the most obvious
symptom as cheaply as possible.
2020-04-17 09:45:59 -07:00
Steve Howell 765d40b34c provision: Extract need_to_run_compilemessages.
This is slightly more than a code move, as we
now skip some unnecessary file I/O when
`is_force` is `True`.
2020-04-17 09:45:59 -07:00
Steve Howell 067196c508 provision: Simplify `is_force` codepaths.
I remove `is_force` from `file_or_package_hash_updated`
and modernize its mypy annotations.

If `is_force` is `True`, we just now run the thing
we want to force-run without having to call
`file_or_package_hash_updated` to expensively
and riskily return `True`.

Another nice outcome of this change is that if
`file_or_package_hash_updated` returns `True`,
you can know that the file or package has
indeed been updated.

For the case of `build_pygments_data` we also
skip an `os.path.exists` check when `is_force`
is `True`.

We will short-circuit more logic in the next
few commits, as well as cleaning up some of
the long/wrapper lines in the `if` statements.
2020-04-17 09:45:59 -07:00
Steve Howell f98843d197 provision: Add build_emoji prefix to message.
This is similar to what we do in generate_secrets,
and it makes the output from a no-op provision
a bit more consistent.
2020-04-17 09:45:59 -07:00
Steve Howell 478b50dde3 provision: Improve message for configure-rabbitmq.
We change the message for skipping RabbitMQ
configuration to match nearby messages:

    No need to run `tools/setup/build_pygments_data`.
    No need to run `scripts/setup/inline_email_css.py`.
    No need to run `scripts/setup/configure-rabbitmq.
    No need to regenerate the dev DB.
    No need to regenerate the test DB.
    No need to run `manage.py compilemessages`.
2020-04-17 09:45:59 -07:00
Puneeth Chaganti 6b3358b14f generate-integration-docs-screenshot: Allow sending custom headers.
This commit makes it convenient to specify additional headers to send in the
integration webhook request from the command line.
2020-04-17 09:41:55 -07:00
Puneeth Chaganti 05101b4f5a docs: Add a note on manually generating integration screenshots. 2020-04-17 09:41:55 -07:00
Puneeth Chaganti d2eaf799e6 docs: Recommend using generate-integration-docs-screenshot. 2020-04-17 09:41:55 -07:00
Puneeth Chaganti 6abb412538 webhooks/teamcity: Change teamcity build triggering user to iago.
To be able to get a screenshot of the personal message using the
`generate-integration-docs-screenshot` tool, this commit changes the
personal build to be triggered by iago, instead of cordelia.
2020-04-17 09:41:55 -07:00
Puneeth Chaganti 177a547587 webhooks/github: Delete a duplicate fixture.
The request_review_pull_request.json file is a duplicate of
pull_request__review_requested.json with data for a different pull-request.
2020-04-17 09:41:55 -07:00
Puneeth Chaganti 32afb4076a webhooks/semaphore: Remove accidentally created fixture file.
aa12002be7 seems to have accidentally placed a
copy of `sentry/fixtures/exception_message.json` here.
2020-04-17 09:41:55 -07:00
Puneeth Chaganti 36623cddfd webhooks/dialogflow: Remove default value for email parameter.
The webhook view used a default value for the email, which gave
non-informative errors when the webhook is incorrectly configured without
the email parameter.
2020-04-17 09:41:55 -07:00
Puneeth Chaganti 97792466ec webhooks/basecamp: Add support for todo_uncompleted event type.
We have a fixture for this event in the repo, but the event was not listed
in the supported event types list. It is also documented in the Basecamp API
docs here:
https://github.com/basecamp/bc3-api/blob/master/sections/webhooks.md
2020-04-17 09:41:55 -07:00
Puneeth Chaganti 01efb351d5 webhooks/basecamp: Fix typo in todo_due_on_changed event name.
The event name seems to have been incorrectly called `todo_due_date_changed`
instead of `todo_due_on_changed`. The API docs for webhooks don't mention
the correct event name, but the TODO json payload[1] seems to contain the
`due_on` field, aside from the fixture actually referring to
`todo_due_on_changed` event type.

[1]: https://github.com/basecamp/bc3-api/blob/master/sections/todos.md
2020-04-17 09:41:55 -07:00
Puneeth Chaganti 84e411c543 generate-integration-docs-screenshot: Fix crash on ignored fixtures.
When using a fixture that is correctly handled by our webhooks, but don't
cause a notification message to be sent, the tool shouldn't crash.
2020-04-17 09:41:55 -07:00
Puneeth Chaganti 9248b16e86 message-screenshot: Create image directory if it doesn't exist. 2020-04-17 09:41:55 -07:00
Puneeth Chaganti cee240fb74 generate-integration-docs-screenshot: Raise ArgumentTypeError.
When an invalid fixture is passed as an argument to the tool, raise an
`ArgumentTypeError`, instead of a `ValueError`.
2020-04-17 09:41:55 -07:00
Puneeth Chaganti ae754887eb generate-integration-docs-screenshot: Message to run dev server.
If the dev server is not running, when this tool is run, we print a clear
error message to start the dev server first, and then run this tool.
2020-04-17 09:41:55 -07:00