Commit Graph

37443 Commits

Author SHA1 Message Date
Anders Kaseorg 58942e2616 test_embedded_bot_system: Replace type: ignore annotations with an assert.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg 123b53ae86 test_push_notifications: Fix type: ignore issues.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg feeb39a55f timezone: Strengthen get_timezone type.
pytz.BaseTzInfo is a subclass of datetime.tzinfo that adds the
localize and normalize methods.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg 1d545efac2 custom_profile_fields: Replace a type: ignore with an assert.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg a3a39494e3 video_calls: Annotate a type: ignore with a specific bug URL.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg 57b87269ec test_signup: Remove dead code with type: ignore issues.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg a4f2704301 flush-memcached: Replace a type: ignore with an assert.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg e883567146 test_stripe: Fix a type: ignore issue.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg ca1d9603cb decorator: Fix type of signature-changing decorators.
In a decorator annotated with generic type (ViewFuncT) -> ViewFuncT,
the type variable ViewFuncT = TypeVar(…) must be instantiated to
the *same* type in both places.  This amounts to a claim that the
decorator preserves the signature of the view function, which is not
the case for decorators that add a user_profile parameter.

The corrected annotations enforce no particular relationship between
the input and output signatures, which is not the ideal type we might
get if mypy supported variadic generics, but is better than enforcing
a relationship that is guaranteed to be wrong.

This removes a bunch of ‘# type: ignore[call-arg] # mypy doesn't seem
to apply the decorator’ annotations.  Mypy does apply the decorator,
but the decorator’s incorrect annotation as signature-preserving made
it appear as if it didn’t.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg 95c6d44a4a test_runner: Remove unused type: ignore comments.
Also enable warn_unused_ignores.  I think the fact that there are so
few of these is good evidence that it’s not a significant burden for
people fixing type errors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-23 11:29:54 -07:00
Anders Kaseorg 30ab0524b5 video_calls: Don’t request a scope for the Zoom OAuth session.
As requested by a Zoom reviewer for unclear reasons.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 18:48:35 -07:00
Anders Kaseorg 8b2d6806ea compose: Fix video call button when Big Blue Button isn’t enabled.
Fixes ‘Uncaught TypeError: can't access property "id",
available_providers.big_blue_button is undefined’ introduced by commit
a389c7390d (#14775).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 18:47:33 -07:00
Anders Kaseorg 978f25d4ac styles: Use @supports for Mozilla detection.
Fixes these compilation errors from webpack and PostCSS, exposed by
commit b10f156250 (#14997) which tries
to @extend these directives:

Unexpected '}' at app.d5da4b9d46e79634b8fb.css:9103:4.
Unexpected '}' at app.d5da4b9d46e79634b8fb.css:9104:0.
Invalid property name '@-moz-document url-prefix() {

            @nest & #settings_page select {
        background-color' at night_mode.scss:788:0. Ignoring.
Invalid selector '}
}

.user_status_overlay .overlay-content' at night_mode.scss:797:4. Ignoring.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 18:11:28 -07:00
Anders Kaseorg 1e4fc8f2bf users: Avoid unchecked cast.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 17:18:19 -07:00
Anders Kaseorg 086a3ef18b check_remove_custom_profile_field_value: Fix type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 17:18:19 -07:00
Anders Kaseorg b62c82c3e1 tests: Avoid unchecked casts.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 17:18:19 -07:00
Anders Kaseorg 579f05f3ed queue_processors: Avoid unchecked casts.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 17:18:19 -07:00
Anders Kaseorg f33bfaf545 import_realm: Avoid unchecked cast.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 17:13:48 -07:00
Anders Kaseorg b95fc4858d corporate: Replace unchecked cast calls with assert.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 17:11:42 -07:00
Anders Kaseorg 78f4482867 addressee: Remove redundant casts.
Also enable warn_redundant_casts.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-22 17:11:42 -07:00
Tim Abbott 16cdc3c66b migrations: Fix migration 290 not being marked atomic.
Migrations that add items to a table in the same migration htat
craetes the table require atomic=False.

This fixes this exception:

Running migrations:
  Applying zerver.0287_clear_duplicate_reactions... OK
  Applying zerver.0288_reaction_unique_on_emoji_code... OK
  Applying zerver.0289_tighten_attachment_size... OK
  Applying zerver.0290_remove_night_mode_add_color_scheme...Traceback (most recent call last):
  File "/home/zulip/deployments/2020-06-22-23-20-36/zulip-py3-venv/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/zulip/deployments/2020-06-22-23-20-36/zerver/lib/db.py", line 33, in execute
    return wrapper_execute(self, super().execute, query, vars)
  File "/home/zulip/deployments/2020-06-22-23-20-36/zerver/lib/db.py", line 20, in wrapper_execute
    return action(sql, params)
psycopg2.errors.ObjectInUse: cannot ALTER TABLE "zerver_userprofile" because it has pending trig
2020-06-22 17:08:32 -07:00
Felix a389c7390d calls: Add Big Blue Button as a Video Call Provider.
Big Blue Button needs an API secret so communication to creating a
room has to be done server side.

Fixes #14763.
2020-06-22 16:19:07 -07:00
Tim Abbott 077c741ef4 docs: Simplify reviewing upgrade notes before upgrading.
This adds a convenient way to review the upgrade notes for all Zulip
releases that one is upgrading across.

I thought about moving all the upgrade notes to a common section, but
in some cases the language is clearly explaining changes in the
release that are not duplicated elsewhere, and I think it reads better
having them inline alongisde related changes.
2020-06-22 15:58:52 -07:00
Tim Abbott 866965f162 views: Rename messages.py to message_fetch.py.
This completes to effort to split zerver.views.messages into smaller
modules focused on the different core type of work.
2020-06-22 15:08:34 -07:00
Tim Abbott 3657717ade views: Extract message_send.py for sending views. 2020-06-22 15:08:34 -07:00
Tim Abbott 55448ecf24 views: Extract message_flags.py for flags views. 2020-06-22 15:08:34 -07:00
Tim Abbott 4d7550d705 views: Extract message_edit.py for message editing views.
This is a pretty clean extraction of files that lets us shrink one of
our largest files.
2020-06-22 15:08:34 -07:00
Tim Abbott 1a6799f15e vagrant: Remove uartmode1 woarkound.
We determined that this hack is unnecessary with the official hasicorp
boxes (and it caused problems for some users).

Discussion in this thread:

https://chat.zulip.org/#narrow/stream/21-provision-help/topic/Vagrant.20up.20not.20starting/near/881773
2020-06-22 14:56:38 -07:00
kadrianne e0dc0062eb vagrant: Switch VM box to the Hashicorp release.
This is important because the Hashicorp boxes are better designed, and
in particular, https://www.vagrantup.com/docs/boxes.html recommends
using the hashicorp boxes over the "ubuntu" namespace.
2020-06-22 14:51:31 -07:00
sahil839 28b6af5c4b stream_data: Modify create_sub_from_server_data to use stream id.
This commit changes stream_data.create_sub_from_server_data to use
stream id, instead of stream name, for checking whether subscription
already exists or not. We are using stream ids so that we can avoid
bugs related to live update after stream rename.
2020-06-22 13:39:47 -07:00
sahil839 b99320ffa0 compose_fade: Use stream id to get sub objects.
This commit changes would_receive_message and want_normal_display
functions in compose_fade.js to use stream id, instead of stream
name, to get sub object. We are using stream ids so that we can
avoid bugs related to live update after stream rename.
2020-06-22 13:39:47 -07:00
sahil839 b7f6a51797 message_list_view: Use stream_id to get sub object for populating group.
This commit changes populate_group_for_message_container function to
use stream id to get sub object, instead of stream name.
We already have stream id from message object, so we can easily
use it to fetch sub. We are using stream ids so that we can
avoid bugs related to live update after stream rename.
2020-06-22 13:39:47 -07:00
sahil839 235601d3b6 stream_data: Modify remove_subscriber to use stream id.
This commit changes stream_data.remove_subscriber to use stream id
instead of stream name. We are using stream ids so that we can
avoid bugs related to live update after stream rename.
2020-06-22 13:39:47 -07:00
sahil839 ddbfbdc386 stream: Modify stream_data.add_subscriber to use stream_id.
Thsi commit changes stream_data.add_subscriber to use stream_id
instead of stream name. We are using stream ids so that we can
avoid bugs related to live update after stream rename.
2020-06-22 13:39:47 -07:00
sahil839 320d0ca806 stream: Remove stream_edit.rerender.
This commit removes stream_edit.rerender function. We directly
call subs.rerender_subscriptions_settings directly from
server_events_dispatch.js, which was the only caller of rerender
function, as we already have sub object.
We are using stream ids so that we can avoid bugs related to live
update after stream rename.
2020-06-22 13:39:47 -07:00
sahil839 30c55a1ea7 recent_topics: Use get_sub_by_id in format_topic to get stream info.
We can use get_sub_by_id instead of get_sub to get the stream info,
as we already have stream id from the message object. We are using
stream ids so that we can avoid bugs related to live update after
stream rename.
2020-06-22 13:39:47 -07:00
sahil839 f3604fbb1e stream_edit: Refactor receives_notifications to use stream ids.
This commit changes receives_notifications function to use
stream_ids instead of stream names. We are using stream ids so
that we can avoid bugs related to live update after stream rename.
2020-06-22 13:39:47 -07:00
Aman Agrawal ae43ef5959 recent_topics: Make avatars bigger and borderless.
Set vertical alignment of contents in middle of row.
2020-06-22 12:56:19 -07:00
Priyank Patel 89619767cd test_server: Double the timeout amount to avoid flakes.
These timeout flakes, when running puppeteer test, have been fairly
frequent in CI, so increase the timeout.
2020-06-22 12:30:32 -07:00
Gittenburg af867cb26c recent_topics: Fix buggy scrolling.
The knob of the scroll bar scrolled out of view in both Firefox and
Chromium and on Firefox it even cut off the last entry.

Fixes #15511.
2020-06-22 12:20:43 -07:00
Gittenburg 8333e11378 emoji_picker: Fix no hover effect when filtering.
Fixes #15487.
2020-06-22 07:03:07 -04:00
Tim Abbott 5d6f3d0e3a docs: Fix typo in 'substituted'. 2020-06-21 10:56:40 -07:00
Tim Abbott dc2a045d3b docs: Add documentation on mypy @overload.
We only use this in a few places, but they're really important places
for understanding the types in the codebase, and so it's worth having
a bit of expository documentation explaining how we use it.

(And I expect we'll add more with time).
2020-06-21 10:51:47 -07:00
Mohit Gupta 02ea52fc18 filter: Implement has: filters on client side.
Prior to this commit has:link, has:attachment, has:image
filter couldn't be applied locally and deferred filtering to
web server. This commits make sure client filters all messages
it can instead of completely deferring to the server and hence
improve speed.

A tradeoff is also made to turn off local echo for has: narrows
as messages with link sent to has:link narrow were locally echoing
to another narrow and not appearing in the active has:link narrow.

Fixes: #6186.
2020-06-21 10:26:09 -07:00
YashRE42 a4f5b0c635 message_controls: Prevent clicks via visibility & not pointer-events.
Previously, the message controls had a bug where they would trigger on
mobile with a single tap over the area they occupy when visible. This
is wrong because a user would expect to first see the controls and
only trigger them once they are visible (with a second tap).

The above bug is caused by the fact that we were using "opacity: 0" on
".message_controls > div" to hide the controls and "opacity: 1" on
".messagebox &:hover .message_controls > div" to show the controls on
hover, however, this would not effect the click action because
"opacity". So we used "pointer-events: none;" and "pointer-events:
all;" with the hopes that it would prevented the above bug, but in
practice, it didn't.
(the most probable explanation being that tapping the message_control
area would cause the "&:hover" rule to trigger and change the
"pointer-event" to "all" before it could prevent the click trigger,
But that explanation is just conjecture.)

This commit replaces both "pointer-events" attributes with
"visibility: hidden" and "visibility: visible" respectively. The
result being that the message_controls behave identically to before,
except without the above bug.

The addition to the ".has_actions_popover .info" selector is important
because without it, we would regress on issue #3172.

Trivia:
An alternate approach to using "opacity" is to set the
"display" attribute to "none", however, using "display" prevents the
transition from animating (which is probably why we were using opacity
here in the first place). "visibility" does not prevent the transition
from animating.

History: The "pointer-events" attribute was introduced in
4d5aa3ddc9 and it replaced prior code
which relied on the "visibility" attribute... But it seems PR #3792
was mostly focused on improving the positioning through removal of
`display: none`, but introduced opacity to make the animations work
rather than visibility as the replacement solution, which requires the
pointer-events hack and resulted in the bug described here.

Fixes the second bug described in #13642.
2020-06-21 10:12:41 -07:00
Aman Agrawal 572e504d4e recent_topics: Move "Include muted" filter beside "All" filter.
This helps user understand "Include muted" filter better and
saves keypress to focus on more used filters like "participated"
and "unread".

See https://github.com/zulip/zulip/issues/15482.
2020-06-21 10:03:26 -07:00
dangraw d24c26b9e4 stream edit: Add <Enter> keyboard shortcut to invite users to stream.
Fixes #15185.
2020-06-21 09:57:00 -07:00
Tim Abbott 96044d0bd1 stream_edit: Extract submit_add_subscriber_form. 2020-06-21 09:57:00 -07:00
sahil839 f10efa27b8 users: Add docs link next to the label of dropdown for changing user's role.
This commit adds link to 'roles and permissions' docs next to the label
of dropdown for changing user role.
2020-06-21 09:41:46 -07:00
sahil839 3498287b8c invite: Add docs link next to the user-role dropdown label in invite modal.
This commit adds link to 'roles and permissions' docs next to the
label of user role dropdown in invite modal.
2020-06-21 09:41:46 -07:00