Commit Graph

27411 Commits

Author SHA1 Message Date
Cynthia Lin 1babd6aa28 help: Prevent scrolling on sidebar when collapsed in mobile view. 2018-07-13 18:03:32 +05:30
Cynthia Lin 8ee034a41c help: Prevent scrolling when cursor is on body.
When you hover above the navbar, the cursor focuses on the page
body and scrolls the entire page, breaking the positioning of the
fixed sidebar and page content.

We disable scrolling on the body but allow the sidebar and Markdown
content page elements to be scrolled to fix this bug.
2018-07-13 18:03:32 +05:30
Tim Abbott 3cc93fd721 setup_venv: Fix missing libssl-dev dependency.
We were already correctly including libssl-dev in Zulip's dependencies
in development environment provisioning, but (at least now) it's
needed to build certain Python packages like pycurl when building a
Zulip virtualenv in production.  I haven't investigated why we didn't
need this on Ubuntu, but one possible reason would be that some other
library in our dependencies list happens to depend on it on Ubuntu.

We fix this by moving the dependency over to the shared
VENV_DEPENDENCIES list.

Fixes part of #9946.
2018-07-13 18:00:38 +05:30
Tim Abbott 8f9b5633b8 zulip_tools: Fix accessing LSB data on Debian stretch.
Apparently, at least some Debian stretch systems don't have an
/etc/lsb-release, so the optimization that we did in
5d39a0f0fc broke our installer on
Debian.

We fix this, by falling back to calling the lsb_release command on
systems that don't have a faster way to do it.

Fixes part of #9946.
2018-07-13 18:00:38 +05:30
Aastha Gupta dfde4fac85 invitations: Send 'invites_changed' event for invitations events.
Fixes #7665

In case of invitation events, 'invites_changed' event without
any real payload is sent to all the realm admins and the user.
The event is handled by reloading the list to view recent changes.

Commit tweaked by shubhamdhama:
* Send an `invite_changed` event when an user accept an invite.
    Also, added the test for the same.
* No need to delete the invite list in frontend, current logic
    handles the case when the invite data is changed properly.
* Extracted the common logic for sending an event into
    `notify_invites_changed`.
2018-07-13 18:00:06 +05:30
Tim Abbott 40efac2193 api docs: Clean of high levels of code nesting.
An early continue here makes the code a lot more readable.
2018-07-13 17:39:20 +05:30
Yago González 1cdd6862b7 api docs: Display example arguments as JSON.
Some of the arguments in our REST API have to be sent as JSON objects,
which only accept double quotes for strings.

If we display the examples as normal Python objects, the syntax would be
quite similar but it would use simple quotes, which is invalid JSON (and
isn't accepted by the server).

That's why all the examples should be JSON-serialized in order to comply
with the API's requirements.
2018-07-13 17:36:41 +05:30
Yago González c2f3c4282b api docs: Show message when there are no arguments.
Until now, we were displaying an empty "Arguments" section in the REST
API docs whenever an endpoint didn't use input arguments.

In the case of OpenAPI-based docs, that was also annoying because it
required removing the {generate_api_arguments_table|...} template tag or
leaving an empty "parameters" field in zulip.yaml.

After this, we show a paragraph indicating that the endpoint doesn't
need arguments under the "Arguments" section.
2018-07-13 17:36:40 +05:30
Yago González e6631db6b6 api docs: Raise exception on missing argument file.
If the argument table generator isn't able to reach a file that is
supposed to read, the two most likely causes are:

- The source .md documentation file that is requesting the table has a
typo in the path.
- The file with the arguments isn't there, for some reason.

In either case, we don't want the server to fail silently-ish and
display the docs as if there was no arguments for that endpoint. That's
why the most logic thing to do is to raise an exception and let the
admins know that there's something wrong.
2018-07-13 17:33:06 +05:30
Anders Kaseorg f75c0e29f4 HTML validation: Remove obsolete attributes from <script>, <style>.
<script charset=…>, <script type=…>, and <style type=…> are “obsolete
but conforming” in HTML5.  They make the validator.nu output noisier
and real problems a little harder to find.

(type was required in HTML 4, which is not relevant to us.)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-13 10:27:23 +05:30
Anders Kaseorg c28ab72124 HTML validation: Remove invalid attributes.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-13 10:27:23 +05:30
Cynthia Lin 0ed13e3631 stats: Fix incorrect data-user attribute on Everyone button.
For some reason, it was defined as "realm" instead of "everyone",
resulting in undefined value JS errors when draw_plot() was called.

Fixes #9937.
2018-07-13 10:24:13 +05:30
Rhea Parekh fff0f64dea tests: Refactor tests for importing huddles. 2018-07-13 01:14:42 +05:30
Rhea Parekh ee830ddee9 tests: Fix mypy bug in test_import_realm. 2018-07-13 01:14:42 +05:30
Yago González 0e135b69f9 alert words: Return the updated list when adding/removing words.
POST and DELETE operations in /users/me/alert_words may leave the
user's list of alert words in an unknown state: POSTing adds words to a
list that the client may not know from the begining, and the same with
DELETE.

Replying with the current status of the alert words list is the best way
of letting the client alter the list and knowing its contents after
being updated with a single query.

This is especially useful taking into account that POSTing words that
were already present and DELETing non-existing words both produce a
successful response.

An extra test has been added to avoid leaving GET /users/me/alert_words
too untested.
2018-07-13 01:01:00 +05:30
Yago González 3b21b17a35 alert words: Make alert_words required for POST and DELETE.
Querying an endpoint with no information (thus a noop) and it producing
a successful response doesn't seem to be expected.

Given the case that the client makes such query with no content it will
probably be unintentional and the API should let them know about it.
2018-07-13 01:01:00 +05:30
Joshua Pan 3ac49c1503 mlv: Remove unecessary function names.
We have deprecated this code style.
2018-07-12 11:43:21 -04:00
Joshua Schmidlkofer b1a57d144f thumbor: Add production installer/puppet support.
This commits adds the necessary puppet configuration and
installer/upgrade code for installing and managing the thumbor service
in production.  This configuration is gated by the 'thumbor.pp'
manifest being enabled (which is not yet the default), and so this
commit should have no effect in a default Zulip production environment
(or in the long term, in any Zulip production server that isn't using
thumbor).

Credit for this effort is shared by @TigorC (who initiated the work on
this project), @joshland (who did a great deal of work on this and got
it working during PyCon 2017) and @adnrs96, who completed the work.
2018-07-12 20:37:34 +05:30
Rhea Parekh e9884916c9 import: Support import of huddles.
For importing huddles we have to have unique huddle hashes.
Huddle hashes are extracted from the list of users participating
in a huddle. So to extract these user ids, we first use huddle
id to getting the matching recipient, and then we use subscription
to get the user ids from the recipient id.

Added tests for the same (tests slightly tweaked by tabbott).
2018-07-12 19:06:52 +05:30
Yago González fa1a695e08 test-api: Fix broken check for get_members.
The tests for GET /users were looking for a specific user, asuming that
it would always be in the same position. Since the users' sorting isn't
guaranteed in any way, this can lead to errors in the tests.

Now we make sure the user we grab from the list is the one we need by
checking its email address.

This is just a hotfix that addresses the short-term problem: we have
already made some efforts to make sure these tests are more
deterministic, and now we only need to finish the migration of the old
enpoints to the new system as a long-term solution.
2018-07-12 18:54:06 +05:30
Anders Kaseorg ae55107560 HTML validation: Replace Drafts button with styled link.
<button> inside <a> is invalid.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-12 18:47:10 +05:30
Anders Kaseorg 05dc132fb2 HTML validation: Add placeholder text to <h1>, <h3>.
Otherwise validator.nu warns about the empty header tags.  The
placeholder text is replaced by JavaScript.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-12 18:46:31 +05:30
Anders Kaseorg 6107382b2a HTML validation: Remove invalid <pipe> element from portico-header.
It seems to have been there to paper over a styling problem that was
actually caused by slightly mismatched font sizes (em vs. rem).

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2018-07-12 18:46:31 +05:30
Harshit Bansal 8ada7cfe5b tools: Add import_emoji_names_from_csv tool. 2018-07-12 18:05:02 +05:30
Tim Abbott 5ae90d60d7 tests: Fix a failing test in test_users.py.
This small change should have been included in
d1cda29fb4.
2018-07-12 15:05:16 +05:30
Greg Price 6d44772925 mypy: Add a first stub file, for yamole.
The main purpose of this commit is to demonstrate end-to-end that
our setup for type stubs works.  I picked this library more or less
arbitrarily as one where the API surface we use is tiny, so that the
stub would be extra easy to write.
2018-07-12 14:10:53 +05:30
Greg Price 36cf898589 mypy: Add a place to put type stubs.
This will allow us to begin to add our own stubs for external
libraries.  Writing stubs can be surprisingly little work to do, and
can have high leverage in keeping our type annotations high-quality.
2018-07-12 14:10:09 +05:30
Sarah d1cda29fb4 API: Add stream email notification setting plumbing.
This is all the plumbing that makes it possible to enable the
stream_email_notifications setting via the Zulip API.  The flag still
doesn't do anything yet, but this is a nice checkpoint along the way
to implementing this feature.
2018-07-12 13:39:14 +05:30
Tim Abbott 7e3c4deeac emails: Use direct links to notification settings.
Now that we support such direct links, we should be using them where
necessary in our emails.
2018-07-12 13:39:14 +05:30
Vishnu Ks 895c7703a6 billing: Show the billing page only to admins and billing users. 2018-07-12 12:51:38 +05:30
Vishnu Ks 377fac2864 billing: Pass stripe_customer instead of Customer in upgrade functions. 2018-07-12 12:51:38 +05:30
Tim Abbott aa5ca4e549 actions: Remove unnecessary import of EmailMessage.
Usually we don't bother with unused imports, but this helps with
reasoning about where we use the Django mail APIs in Zulip.
2018-07-12 12:32:27 +05:30
Joshua Pan 533eccd655 models: Create delivery_email field in userprofile.
This commit creates a new field called delivery_email. For now, it is
exactly the same as email upon user profile creation and should stay
that way even when email is changed, and is used only for sending
outgoing email from Zulip.

The purpose of this field is to support an upcoming option where the
existing `email` field in Zulip becomes effectively the user's
"display email" address, as part of making it possible for users
actual email addresses (that can receive email, stored in the
delivery_email field) to not be available to other non-administrator
users in the organization.

Because the `email` field is used in numerous places in display code,
in the API, and in database queries, the shortest path to implementing
this "private email" feature is to keep "email" as-is in those parts
of the codebase, and just set the existing "email" ("display email")
model field to be something generated like
"username@zulip.example.com" for display purposes.

Eventually, we'll want to do further refactoring, either in the form
of having both `display_email` and `delivery_email` as fields, or
renaming "email" to "username".
2018-07-12 12:30:20 +05:30
Joshua Pan 4b3fb746ea Remove incorrect setting of user_profile.email.
user_profile.save() is never called, so this line of
code is actually useless.
2018-07-12 12:23:46 +05:30
Eeshan Garg 3eaf00444a markdown: Render nested multi-line code blocks correctly.
This commit adds a Markdown tree-processor extension that renders
multi-line code blocks that are nested inside lists with the
formatting. Note that the code block could be nested inside multiple
list levels and would still get rendered correctly.

Tim: This fixes the need for unpleasant workarounds like
f5bfa4e793 and makes nested code blocks
in our documentation look exactly how users would expect them to.
2018-07-12 12:22:04 +05:30
Yago González a3d42d9901 test-api: Pass non-admin client to the test helpers. 2018-07-11 23:54:00 +05:30
Rhea Parekh ecc5b75500 tests: Refactor test_import_realm for clarity. 2018-07-11 23:37:06 +05:30
Tim Abbott 5371589c76 setup-advanced: Remove broken links for old tsearch_extras packages.
It appears Luke's Dropbox folder/shared link that used to host some
tsearch_extras binaries was removed.  It wasn't very high-value
regardless, because most of the platforms involved are deprecated, the
ones that don't generally have a PPA, and building from source is
pretty easy.  So, we just remove these options from the documentation.

While we're at it, make clear we only support direct installation on
Ubuntu LTS.

Fixes #9863.
2018-07-11 21:35:23 +05:30
Aditya Bansal c47db1a1e8 left_sidebar.html: Upgrade to use font-awesome 4.7 icon prefixes. 2018-07-11 20:31:18 +05:30
Aditya Bansal 82877fa116 recipient_row.handlebars: Upgrade to font-awesome 4.7 icon prefixes. 2018-07-11 20:31:17 +05:30
Aditya Bansal fb839c1d5b compose.html: Upgrade to use font-awesome 4.7 icon prefixes.
We also adjust some CSS so that icons after this upgrade look exactly
or nearly the same as they did before the upgrade.
2018-07-11 20:31:17 +05:30
Aditya Bansal 61e4bb1bf4 user_info_popover_content.handlebars: Use fa-4.7 icon prefixes. 2018-07-11 20:31:17 +05:30
Aditya Bansal f605fdf2c8 topic_edit_form.handlebars: Upgrade to font-awesome 4.7 icon prefixes. 2018-07-11 20:31:17 +05:30
Aditya Bansal 1fb2dc5b65 tab_bar.handlebars: Upgrade to font-awesome 4.7 icon prefixes. 2018-07-11 20:31:17 +05:30
Aditya Bansal 6f5a1d3893 stream_sidebar_row.handlebars: Upgrade to font-awesome 4.7 icon prefixes. 2018-07-11 20:31:17 +05:30
Aditya Bansal dad1b60355 stream_sidebar_actions.handlebars: Use fa-4.7 icon prefixes. 2018-07-11 20:31:17 +05:30
Aditya Bansal 66096e9509 single_message.handlebars: Upgrade to font-awesome 4.7 icon prefixes. 2018-07-11 20:31:17 +05:30
Aditya Bansal 37b1100a2c organization-settings-admin.handlebars: Use fa-4.7 icon prefixes. 2018-07-11 20:31:17 +05:30
Aditya Bansal 4731ad1a1b account-settings.handlebars: Upgrade to font-awesome 4.7 icon prefixes. 2018-07-11 20:31:17 +05:30
Aditya Bansal 69afb0673c message_edit_form.handlebars: Upgrade to font-awesome 4.7 icon prefixes. 2018-07-11 20:31:17 +05:30