Commit Graph

46374 Commits

Author SHA1 Message Date
Anders Kaseorg 56518e094c test_new_users: Select test emails deterministically.
The previous random strategy for picking 5 emails would result in
collisions in 1 out of 10000.35 tests, leading to
psycopg2.errors.UniqueViolation.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-11 18:09:43 -08:00
Anders Kaseorg 961633fcec timezone: List only canonical timezone identifiers.
For aliases that will no longer be listed, see the third column of

grep '^L ' zulip-py3-venv/lib/python3.*/site-packages/pytz/zoneinfo/tzdata.zi

Time zones previously set to an alias will be canonicalized on demand.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-11 17:38:57 -08:00
Tim Abbott c4af509339 left sidebar: Increase bottom margin.
This improves the visual appearance of the state where you're scrolled
to the bottom with your mouse over a URL.
2022-02-11 14:33:54 -08:00
jai2201 e11c495dff left-sidebar: Leave space below link for it to be visible.
Add a margin below the subscription link for it to be visible when we
hover over links, where the browser will display the URL in the
bottom-left corner of the screen.
2022-02-11 14:28:30 -08:00
jai2201 2281adc101 left-sidebar: Make subscription link non-sticky. 2022-02-11 14:28:09 -08:00
Tim Abbott c674d4cac0 templates: Fix indentation formatting of input_pull.hbs. 2022-02-11 13:58:02 -08:00
Tim Abbott 1a7c4a0276 scripts: Fix typo in logging statement. 2022-02-11 13:47:24 -08:00
YashRE42 96682a3517 status_emoji: Show status emoji in compose_pm and mentions typeaheads.
Previously the emoji_status set by the user would only be seen in a
few places, it was decided that it would be useful to show the
emoji_status in a couple of other additional places as well.

As such this commit uses the status_emoji template to show the status
emoji in the compose_pm typeahead and the mentions typeahead.

Status emoji changes do not live update these, but neither do user
renames, so there's bigger problems if that's a concern.

Fixes: #19865.
2022-02-11 13:30:08 -08:00
YashRE42 fa7c8f8c32 status_emoji: Show status emoji in compose_pm pills.
Previously the emoji_status set by the user would only be seen in a
few places, it was decided that it would be useful to show the
emoji_status in a couple of other additional places as well.

As such this commit uses the status_emoji template to show the status
emoji in the compose_pm pills. Due to the fact that we use the same
pills system to render in the user_group, we need to add a
conditional to prevent rendering there since the user status is not
valuable there.

Status emoji changes do not live update these, but neither do user
renames, so there's bigger problems if that's a concern.
2022-02-11 13:30:08 -08:00
Tim Abbott 93ce3396ac status emoji: Adjust margin for common element.
After some experimentation, these styles look better in all the places
we're displaying status emoji.  See the comments for justification.
2022-02-11 13:29:32 -08:00
AnushaNathRoy 8da5edb7af status_emoji: Show status emoji in message_body.
Previously the emoji_status set by the user would only be seen a few
places, it was decided that it would be useful to show the
emoji_status in a few additional other places as well.

Use the status_emoji template to show the status emoji in the
message_body and also implement live update behavior.

With refactor and minor edits by Yash RE.

Co-authored-by: YashRE42 <33805964+YashRE42@users.noreply.github.com>
2022-02-11 13:02:56 -08:00
AnushaNathRoy e1fd47a692 status_emoji: Show status emoji in single PMs in the PM list.
Previously the emoji_status set by the user would only be seen in the
buddy list, it was decided that it would be useful to show the
emoji_status in other places as well.

As such this commit uses the status_emoji template to show the status
emoji in the PM list and also implements live update behavior.

With refactor and minor edits by Yash RE.

Co-authored-by: YashRE42 <33805964+YashRE42@users.noreply.github.com>
2022-02-12 01:06:52 +05:30
Tim Abbott fdabf0b357 pgroonga: Disable PGroonga in development to fix CI.
A recent Postgres upstream release appears to have broken PGroonga.
While we wait for https://github.com/pgroonga/pgroonga/issues/203 to
be resolved, disable PGroonga in our automated tests so that Zulip
CI passes.
2022-02-11 11:35:43 -08:00
Mr.mad 22bfa56301 left sidebar: Redirect users with no stream create permissions.
Previously, when the user clicked the `Add streams` icon in the
streams list sidebar, we provided a popover offering to create or
subscribe.  This was confusing for users who did not have permission
to create streams.

Redirect users that don't have stream creation permissions
directly to browse streams without going through this popover.

Fixes: #20676.
2022-02-11 11:02:09 -08:00
Tim Abbott a6c364cdd7 left sidebar: Rename streams_inline_cog.
The icon hasn't been a cog for some time.
2022-02-11 10:58:32 -08:00
Tim Abbott edf16cb861 upload: Mark migration code as nocoverage.
We want to add tests here, but it's more important to fix main failing
CI.
2022-02-11 10:37:58 -08:00
Mateusz Mandera c6be15908c import: Ensure that .author gets set when importing RealmEmoji.
Sometimes we may get data to import, due to export bugs, malformed data
etc., which doesn't have the invariant of RealmEmoji.author always being
set. The import code should fix that, by choosing a reasonable default
and setting it.
2022-02-11 18:21:38 +01:00
Mateusz Mandera 30ac291eba emoji: Add migration to reupload all RealmEmoji and ensure .author.
Fixes #19732.
2022-02-10 17:45:31 -08:00
Tim Abbott 8e68e98e33 help: Fix incorrect explanation of generic bots.
The previous explanation of generic bots was inaccurate.

This page needs a lot more cleanup, but this at least fixes the
clearest inaccuracies.

Fixes #19978.
2022-02-10 17:31:35 -08:00
Alex Vandiver 8da6098631 upgrade: Catch "upgrade" attempts which would downgrade the database.
Attempting to "upgrade" from `main` to 4.x should abort; Django does
not prevent running old code against the new database (though it
likely errors at runtime), and `./manage.py migrate` from the old
version during the "upgrade" does not downgrade the database, since
the migrations are entirely missing in that directory, so don't get
reversed.

Compare the list of applied migrations to the list of on-disk
migrations, and abort if there are applied migrations which are not
found on disk.

Fixes: #19284.
2022-02-10 16:02:49 -08:00
Alex Vandiver 71e02d7893 zulip_tools: Factor out ZULIP_VERSION parsing. 2022-02-10 16:02:49 -08:00
Alya Abbott 98f6cdadab portico: Fix bad image mirroring on /for/X pages.
Also mirror one image that should be mirrored but wasn't.
2022-02-10 13:55:00 -08:00
Tim Abbott 68055048a0 message feed: Add 4px left margin to edited notices.
This makes them not look squished up against the name.
2022-02-10 13:52:24 -08:00
jai2201 67625d6c7b message_feed: Remove the parenthesis around edited notices.
They were found to not particularly improve the UI.

Fixes #21043.
2022-02-10 13:52:24 -08:00
Anders Kaseorg ad232c9b65 sqlalchemy_utils: Remove NonClosingPool.recreate override.
There doesn’t seem to be a reason to override this, and the upstream
method it was based on has diverged since this was written.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-10 11:59:41 -08:00
Anders Kaseorg 29330c180a sqlalchemy_utils: Make get_sqlalchemy_connection a context manager.
Although our NonClosingPool prevents the SQLAlchemy connection from
closing the underlying Django connection, we still want to properly
dispose of the associated SQLAlchemy structures.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-10 11:59:41 -08:00
Anders Kaseorg 8e5ae4e829 message_fetch: Use Row._mapping.
Fixes these warnings with SQLALCHEMY_WARN_20=1:

RemovedIn20Warning: Using non-integer/slice indices on Row is
deprecated and will be removed in version 2.0; please use
row._mapping[<key>], or the mappings() accessor on the Result
object. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)

RemovedIn20Warning: Using the 'in' operator to test for string or
column keys, or integer indexes, in a :class:`.Row` object is
deprecated and will be removed in a future release. Use the
`Row._fields` or `Row._mapping` attribute, i.e. 'key in
row._fields' (Background on SQLAlchemy 2.0 at:
https://sqlalche.me/e/b8d9)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-10 11:59:41 -08:00
Anders Kaseorg fbb8f54d80 message_fetch: Use modern select() calling style.
Fixes this warning with SQLALCHEMY_WARN_20=1:

RemovedIn20Warning: The legacy calling style of select() is deprecated
and will be removed in SQLAlchemy 2.0.  Please use the new calling
style described at select(). (Background on SQLAlchemy 2.0 at:
https://sqlalche.me/e/b8d9)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-10 11:59:41 -08:00
Anders Kaseorg 8769c0c485 message_fetch: Replace Select.column() with Select.add_columns().
Fixes “SADeprecationWarning: The Select.column() method is deprecated
and will be removed in a future release.  Please use
Select.add_columns() (deprecated since: 1.4)”.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-10 11:59:41 -08:00
Anders Kaseorg d5a5b0b5ac message_fetch: Replace SELECT coercion with .subquery().
Fixes “SADeprecationWarning: Implicit coercion of SELECT and textual
SELECT constructs into FROM clauses is deprecated; please call
.subquery() on any Core select or ORM Query object in order to produce
a subquery object.”

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-10 11:59:41 -08:00
Anders Kaseorg e5b24b1723 test_auth_backends: Remove deprecated match_querystring argument.
match_querystring is irrelevant in these cases.  Fixes this warning:

/srv/zulip-py3-venv/lib/python3.7/site-packages/responses/__init__.py:340:
DeprecationWarning: Argument 'match_querystring' is deprecated. Use
'responses.matchers.query_param_matcher' or
'responses.matchers.query_string_matcher'

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-10 11:40:34 -08:00
Aman Agrawal 0ac8f053a6 search_suggestions: Remove filters unusable by spectator. 2022-02-10 11:37:38 -08:00
Aman Agrawal 6e4c2e63f5 right_sidebar: Make spectator login buttons don't stick to scroll bar. 2022-02-10 11:37:38 -08:00
Aman Agrawal bf3bf285a2 recent_topics: Hide mute and read buttons for spectators. 2022-02-10 11:37:38 -08:00
Mateusz Mandera b8ba63e792 management: Run log_email_config_errors in send_test_email command.
The tool needs to run this function, since it uses django's send_email
directly instead of going through our zerver.lib.send_email.send_email
codepath.
2022-02-10 10:55:49 -08:00
Alex Vandiver b7e309c95b docs: Add checklist steps to upgrade puppet dependencies. 2022-02-10 10:00:25 -08:00
Alex Vandiver 291c5e87b6 puppet: Upgrade prometheus to 2.33.1. 2022-02-09 20:32:24 -08:00
Alex Vandiver 2d538c2356 puppet: Upgrade grafana to 8.3.6. 2022-02-09 20:32:24 -08:00
Alex Vandiver f2e66c0b20 puppet: Upgrade go-camo to 2.4.0. 2022-02-09 20:32:24 -08:00
Alex Vandiver 51a516384d puppet: Upgrade golang to 1.17.6. 2022-02-09 20:32:24 -08:00
Alex Vandiver 48263a01dd puppet: Upgrade puppet libraries. 2022-02-09 20:32:24 -08:00
Mr.mad c80275370e stream_color: Fix stream color not updating to default.
Previously, if the user changes any stream color and updates it back
to the default color without reopening the change color popover, the
second color change didn't take effect.

Fix bug by destroying the colorpicker object and rebuilding it again
every time a color change is triggered by the confirm button.

Fixes: #21055
2022-02-09 16:20:24 -08:00
Tim Abbott fc02849865 message_edit: Fix unused parameter in most tests.
The message ID is encoded in the URL, not the PATCH parameters, so
this argument was ignored.  I verified that it appears to have always
matched the value present in the URL.
2022-02-09 15:13:04 -08:00
Tim Abbott 12ed0c3104 message edit: Improve logic for detecting whole topic moves.
The new logic better matches reasonable user expectations, that if you
move all the messages, that's a whole-topic move, regardless of which
propagation mode you selected.
2022-02-09 15:13:00 -08:00
Shubh Gupta 79069b5dec message edit: Indicate how many messages were moved in notificactions.
When moving only part of a topic, it's useful to display that
information to users in these notifications so that it's clear what's
happening.

The most important consequence is actually just increasing confidence
that when you see that the whole topic was moved, that's accurate.

Substantially modified by tabbott.

Fixes #20575.
2022-02-09 15:08:56 -08:00
madrix01 a1e71e8639 topic: Return JsonableError for race condition in topic mute.
To avoid an uncaught IntegrityError causing a 500 HTTP response in a
race between two processes trying to mute a topic, we catch the
integrity error and raise the error exception with status 400 we'd
have gotten if the second request had been a bit later.

Fixes #21011.
2022-02-09 14:35:12 -08:00
madrix01 386de83d74 typo: Remove duplicate assert statement.
We remove duplicate assert statement in
`zerver/tests/test_muting_topic.py`.
2022-02-09 14:31:25 -08:00
YashRE42 c81a8c0346 message_live_update: Only rerender relevant messages for name/avatar.
Previously, we would call `rerender_messages_view()` in order to
rerender messages after user renames or avatar updates. This would
lead to rerendering the entire message list for every change,
regardless of whether any specific message had changed or not.

This used to be acceptable because user renames and avatar updates
were rare events, however, as we plan to show user status emoji near
user names and updates to those would be more frequent than is
affordable, this commit implements
`rerender_messages_view_for_user(user_id)` which only rerenders
messages which have actually been changed.

This commit is, thus, both an optimisation for the existing code and a
prep-commit for the user status emoji.
2022-02-09 14:17:36 -08:00
YashRE42 33f9e83588 message_list_view: Recalculate more fields for _rerender_message.
Previously, we used to only calculate sender_is_bot, sender_is_guest,
small_avatar_url and background_color on the message_container via
build_message_groups (ie via .render, which also gets called from
.rerender_with_target_scrolltop).

This would mean that if we tried to use `_rerender_message` to update
just a single message (which is something we'd like to do, in order to
make rerenders more efficient), these values would not update.

(This could lead to avatars not light-updating properly).

As such, this commit moves assignment of these values into
`set_calculated_message_container_variables`.
2022-02-09 14:16:02 -08:00
Anders Kaseorg a800a86f54 Revert "drafts: Use simplebar."
This reverts commit 8e06335788 (#21048).

It regressed the ↑ and ↓ keys because drafts.drafts_scroll was not
updated to use ui.get_scroll_element.  Also, styling the native
scrollbar as hidden is not the right workaround because the hidden
native scrollbar still exists and can be scrolled independently of the
SimpleBar.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-09 14:15:27 -08:00