Commit Graph

46105 Commits

Author SHA1 Message Date
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
Alya Abbott f098556ce1 help: Add a Project size section to GSoC contributor doc. 2022-02-09 14:15:07 -08:00
Parth e3ddd662ab message_editing: Fix topic edit propagate option cut-off.
In the topic changing UI, the 'Change later messages to this topic'
and other options in the drop down were cut off when selected in some
languages like Russian.

Make the selection box width adjust appropriately according to the
length of the text, and also place it on its own line unconditionally.
users.

With tweaks by tabbott to use the same approach we already use in the
"Move topic" modal to have the bottom margin for the color block match
that of the dropdown_list_widget itself, of having them share CSS.

Fixes #19739.
2022-02-09 14:06:49 -08:00
Mateusz Mandera fe61243cfe upload: Don't access emoji_file.name attribute upload_emoji_image.
The S3 backend implementation of upload_emoji_image was accessing
emoji_file.name - which is redundant because emoji_file_name already
gets passed in and can be used, and an object of type IO[bytes] may not
have the .name attribute. Spotted by @Fingel.
2022-02-09 11:26:39 -08:00
Mateusz Mandera e3080f2db4 send_email: Log error if EMAIL_HOST_USER is set without password.
Fixes #20132.

EMAIL_HOST_USER without EMAIL_HOST_PASSWORD is not going to be a valid
configuration, and may result from making mistake in correctly setting
it in the secrets file and end up being a non-obvious cause of failure
to send email. Logging an error will be useful for detecting it. Further
conditions can be added to the function in the future.
2022-02-09 11:04:40 -08:00
Aman Agrawal 197843af31 stripe: Replace "Zulip standard" with "Zulip Cloud Standard".
Case sensitive replace.
2022-02-09 11:00:24 -08:00
Aman Agrawal 7614f2203a pricing: Replace "Zulip Standard" with "Zulip Cloud Standard".
Case sensitive replace.
2022-02-09 11:00:24 -08:00
Sahil Batra 7a2bbc54a8 stream-settings: Fix browser back button behavior for stream settings overlay.
There is no problem in behavior of browser back button we open stream settings
overlay using UI elements since they are appropriately linked to "#streams/all",
"#streams/subscribed" and "#streams/new", but someone can directly go to a
link with "#streams" and in this case we want to fix the browser back button.

This commit replaces "#streams" entry with "#streams/subscribed" which is the
default section opened, such that pressing back when on "#streams/subscribed"
does not go to "#streams" and instead go back actually.
2022-02-09 10:54:52 -08:00
Sahil Batra 9501dd0f94 settings: Fix browser back button not working in settings overlay.
When we open settings overlay we first go to "#settings" hash and
then to "#settings/profile" or hash according to the last opened
section. Now when a user presses back button from "#settings/profile"
it goes to "#settings" which agains then changes to "#settings/profile"
and thus the browser back button does not work as expected.

This commit fixes this by replacing the "#settings" entry in history
with "#settings/profile" or to the hash as per last opened section,
using replaceState and thus there is no entry of "#settings" in history.

Fixes #19820.
2022-02-09 10:54:52 -08:00
Julia Bichler 8e06335788 drafts: Use simplebar. 2022-02-09 10:38:30 -08:00
Alya Abbott 7ed0f595e5 portico: Update /for/business page title and tagline. 2022-02-09 10:22:23 -08:00
Sahil Batra 518024e826 stream_settings: Use button element for button used to change stream permission.
We use button element instead of <a> element for the button used to change
stream permission. This change fixes the focus problem where the container
was focussed when closing the permission modal.

The problem here was because Micromodal focuses the element which was just
focused before opening the modal, on closing the modal. And in this case the
focused element before opening the modal was the "simplebar-content-wrapper"
element as <a> tah without href is not focusable element.

Related issue - #20223.
2022-02-09 10:20:47 -08:00
Steve Howell d5874dc840 puppeteer_tests: Try to fix subscriptions flake.
We use Venice instead of Verona, just in case some other
test is mutating Desdemona's subscription to Verona. (That's
unlikely, but it at least reduces some grep noise for any
future person with that hypothesis.)

And then we try to make sure that Venice is even in the
list of streams.
2022-02-09 13:16:12 -05:00
Alya Abbott 59d84a362e help center: Make it easier to learn that any auth method will work. 2022-02-08 18:04:32 -08:00
Tim Abbott d48a9ac0f4 message_edit: Fix weird variable name for edit history events. 2022-02-08 17:55:08 -08:00
Tim Abbott 729c09074a js: Avoid href="#" for buttons with a JavaScript click handler.
As seen in
https://chat.zulip.org/#narrow/stream/9-issues/topic/edit.20history.20bug/near/1320430,
clicking such a link takes you to the user's default view if the click
handler throws an exception before doing preventDefault().

There hrefs also have the negative effect of having your browser claim
that clicking the link will navigate you to the default view, which it
won't.

Comes with a linter rule to prevent future instances, since it seems
there are some recently added ones, though they are likely the result
of copy/paste.
2022-02-08 17:38:12 -08:00
Tim Abbott 03d3439784 popovers: Offer edit history option for stream moves.
Apparently, we were only dispalying the edit history option in the
message actions popover if the topic/content were changed. Fix this by
adding a small adjustment to the conditional to include stream
changes correctly.
2022-02-08 17:27:37 -08:00
Aman Agrawal 86a78065b4 test_message_fetch: Reorganize web-public tests.
With some extensions by tabbott to cover adjacent corner cases.

Fixes #20288
2022-02-08 17:09:15 -08:00
AnushaNathRoy 5e05dcbc8f status_emoji: Extract status emoji template.
Currently the emoji_status set by the user is only seen in the buddy
list, it would be useful to show the emoji_status in other places as
well.

As such this commit does the prep work of extracting a template which
will be used in all places that need to show the status emoji.

With refactor and minor edits by Yash RE.

Co-authored-by: YashRE42 <33805964+YashRE42@users.noreply.github.com>
2022-02-08 16:52:49 -08:00
YashRE42 768a133715 status_emoji: Modify centering technique for .selected_emoji.
Currently, the emoji_status set by the user is only seen in the buddy
list, it would be useful to show the emoji_status in other places as
well.

As such this commit does the prep work of decoupling the
selected_emoji style in user_status.css from the .status_emoji
style... by having it always override the value of "top".
2022-02-08 16:52:49 -08:00