Commit Graph

55837 Commits

Author SHA1 Message Date
Alex Vandiver 0fe967b1c2 web: Fix links which were missing trailing slashes.
(cherry picked from commit eefe147c34)
2024-03-01 09:26:25 -08:00
sujal 8b1a62f36c setting_ui: Fix sorting by "Expires at" column.
Previously, the sorting was broken due to
incorrect referencing of the property.
The code has been updated to use the "expiry_date"
property instead of "expires_at".

Fixes #29005.

(cherry picked from commit bf464db61b)
2024-03-01 09:26:25 -08:00
Alex Vandiver 3c8796a2ad export_search: Support exporting DMs or huddles.
(cherry picked from commit 6b8365024c)
2024-03-01 09:26:25 -08:00
Karl Stolley 1b451d1958 left_sidebar: Remove padding from bot icon.
This is no longer necessary for vertical alignment, and by
removing the 6px of padding it represents, bot DM rows will have
the same 22px height as other DM rows.

(cherry picked from commit ea83b1f4de)
2024-03-01 09:26:25 -08:00
Karl Stolley fb9c47838d left_sidebar: Remove unnecessary padding on bot icon.
(cherry picked from commit 9887b00317)
2024-03-01 09:26:25 -08:00
Lauryn Menard 85bd8dd33d push-bouncer: Exclude LoggingCountStats with partial data.
LoggingCountStats with a daily duration and that are directly stored
on the RealmCount table (not via aggregation in process_count_stat),
can be in a state, after the hourly cron job to update analytics
counts, where the logged value will be live-updated later, because
the end time for the stat is still in the future.

As these logging counts are designed to be used on the self-hosted
installation for either debugging or rate limiting, sending these
partial/incomplete counts to the bouncer has low value.

(cherry picked from commit 40daf10a74)
2024-03-01 09:26:25 -08:00
Tim Abbott b4f95a54e1 puppeteer: Disable flaky administrative UI test.
(cherry picked from commit ea89a4c6f7)
2024-02-16 15:24:39 -08:00
Tim Abbott b4d26426aa version: Update version after 8.2 release. 2024-02-16 15:22:48 -08:00
Tim Abbott a9fa22965b Release Zulip Server 8.2. 2024-02-16 15:01:33 -08:00
Tim Abbott d2e95f282b i18n: Update translations from Transifex. 2024-02-16 14:44:11 -08:00
Sahil Batra f323aa9709 settings: Fix check_property_changed code for user access setting.
The proposed_val for "realm_can_access_all_users_group" setting
was always returning NaN value which resulted in the value
being included in request even when it was not changed or disabled
due to org not being on "Plus" plan. This resulted in a bug where
user was not allowed to change the "guest" indicator setting
on orgs without "Plus" plan.

For orgs with "Plus" plan there was no problem in changing the
setting but the save button was visible incorrectly if the setting
was set to the initial value.

This commit fixes both the bugs.

(cherry picked from commit 4a98eb205d)
2024-02-16 12:28:16 -08:00
Sahil Batra 727a1eeb1d admin: Remove unnecessary development_environment check.
The "Who can access all users" setting is not disabled for
organizations not on "Plus" plans in production because of
the "page_params.development_environment" check.

We do not need that check anymore as the feature is now
enabled in production.

(cherry picked from commit ae9ef830f0)
2024-02-16 12:28:16 -08:00
Tim Abbott 2064a9da12 web: Use better exponential backoff algorithm.
This matches the algorithm that we designed for the Python API, except
that we use a ratio of 2 rather than sqrt(2) in the message_fetch code
path, because it's a heavier request.

We increase the number of failures before showing a user-facing error
to roughly preserve the same time period before a user-facing error is
shown.

(cherry picked from commit b5b496c752)
2024-02-16 12:28:16 -08:00
Tim Abbott 47e228882c web: Respect rate-limiting headers in main APIs.
Previously, these endpoints just did exponential backoff, without
looking at the rate-limiting headers returned by the server, resulting
in requests that the client could have been certain would fail with an
additional rate-limiting error.

Fix this by using the maximum of the existing exponential backoff with
the value returned by the rate-limiting header.

Fixes #28807.

(cherry picked from commit e3960c22be)
2024-02-16 12:28:16 -08:00
Tim Abbott dbbf860fbb message_fetch: Add small backfill delay.
This should help reduce the risk of hitting rate limits when users
have a very large number of messages to fetch via this mechanism.

Inline the `messages` variable that was only used in one place while
we're touching this.

(cherry picked from commit 8f32ebe706)
2024-02-16 12:28:16 -08:00
Tim Abbott ae05d780c7 reload: Add on-focus handler after a delay.
(cherry picked from commit 9479eae87f)
2024-02-16 12:28:16 -08:00
Tim Abbott 187c9e4b14 util: Fix call_function_periodically.
This function incorrectly and misleadingly did an immediate initial
call, despite both of its callers doing immediate calls themselves (in
one case, with a different parameter passed).

This led to unnecessary server load when reloading the app via event
system triggered reloads, since every client would call `/` twice.

(cherry picked from commit 2c56978b02)
2024-02-16 12:28:16 -08:00
Aman Agrawal 2794c779da narrow: Fix message row partially visible on narrow.
This will prevent any message we want to select after narrowing
from being offscreen entirely or partially.

Steps to reproduce the bug:
* `./manage.py populate_db -n 3000 --max-topics=2`
* Narrow to a stream and scroll high up.
* Align two recipient bars together with nothing between them.
* Click on the first recipient bar after keeping the selected message
  on the second recipient bar.
* You will see that the selected message is not in view.

(cherry picked from commit 120ff78516)
2024-02-16 12:28:16 -08:00
Aman Agrawal 9b49909d3e compose_actions: Fix incorrect condition.
This was introduced in #28767 with the intention to skip scrolling
the selected message.

So, the actual bug that the PR fixed would have been just fixed
by opening the compose box early.

(cherry picked from commit aa76919ddb)
2024-02-16 12:28:16 -08:00
Tim Abbott c9eb942105 narrow: Clarify some confusing details.
The update_selection function name was rather misleading, since that
function call is in fact what renders the message list object for the
view.

Also add comments about a few subtle/confusing details that I noticed
while debugging this code path today.

(cherry picked from commit 61ff8f2bef)
2024-02-16 12:28:16 -08:00
Tim Abbott 8b8ab7fb9c narrow: Open compose box before rendering main message feed.
As discussed in the new comments, we had a bug where the
system-initiated animated scroll that happens when the compose box
opens as a result of narrowing would race with the internal
rerendering that occurs when the message_fetch request asking the
server for additional data returns.

The correct fix for this is just to open the compose box, if we're
going to do so, before setting the user's scroll position in the
narrowing/rendering process.

This ends up being a UI improvement (in that the compose box is
available for typing a bit earlier) as well as avoiding both the risk
of this race as well as the bad UX of adjusting the user's scroll
position multiple times as part of entering the view.

This does not address an as-yet-unknown bug wherein the animated
scroll that occurs when opening the compose box, when racing with a
background rerender, results in a bogus ending scroll position, though
it's easy to see how that might occur given that rerendering does
clear the DOM briefly.

(cherry picked from commit 4e2a282a1b)
2024-02-16 12:28:16 -08:00
Tim Abbott c4dfeb9c37 puppet: Increase minimum memory for multiprocess queue workers.
This should give some more room for systems that are still below 4GB
of RAM to use the lower-memory multithreaded mode, which is less
likely to have OOM kills (a very bad experience).

There should be little cost, as few systems are likely allocated with
memory in this range.

(cherry picked from commit a22f418827)
2024-02-16 12:28:16 -08:00
Tim Abbott 8ea5e2156a puppet: Update rules for number of uwsgi processes.
The defaults for how many uwsgi processes to run no longer depend on
the queue processor mode, but instead the total memory on the system.

(cherry picked from commit 62dbe2298e)
2024-02-16 12:28:16 -08:00
Alex Vandiver 3048ff35d8 requirements: Revert orjson upgrade due to segfault.
Version 3.9.11 and 3.9.12 are susceptible to random segfaults:
- https://github.com/ijl/orjson/issues/452

(cherry picked from commit 437361de32)
2024-02-16 12:17:34 -08:00
Anders Kaseorg 2e4785f51c requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 93198a19ed)
2024-02-16 12:17:34 -08:00
Anders Kaseorg 893c10f869 ruff: Fix DJ012 Order of model's inner classes, methods, and fields.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit e56863fa85)
2024-02-16 12:17:34 -08:00
Anders Kaseorg 7b604d3cde ruff: Fix SIM300 Yoda conditions are discouraged.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit ab25ebd5ce)
2024-02-16 12:17:34 -08:00
Mateusz Mandera d977dfe6e9 push_notifs: Gracefully handle exception when server cant push.
The problem was that earlier this was just an uncaught JsonableError,
leading to a full traceback getting spammed to the admins.
The prior commit introduced a clear .code for this error on the bouncer
side, meaning the self-hosted server can now detect that and handle it
nicely, by just logging.error about it and also take the opportunity to
adjust the realm.push_notifications_... flags.

(cherry picked from commit e8018a7285)
2024-02-16 11:26:05 -08:00
Mateusz Mandera 0a1905ea8d zilencer: Improve json error when plan doesn't allow push notifs.
This allows the self-hosted server to explicitly test for that exception
and catch and log it nicely.

(cherry picked from commit 5b03932d5c)
2024-02-16 11:26:05 -08:00
Alex Vandiver 3d8b9af76d version: Update to point to 8.0 blog post. 2024-01-24 17:50:42 -08:00
Tim Abbott 9099355d11 version: Update version after 8.1 release. 2024-01-24 17:49:27 -08:00
Tim Abbott 93d74607ce Release Zulip Server 8.1. 2024-01-24 17:28:39 -08:00
Anders Kaseorg 6e09c01772 typeahead: Remove insecure default highlighter implementation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-24 16:46:02 -08:00
Anders Kaseorg bc5d4b565a settings_playgrounds: Fix HTML injection in language typeahead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-01-24 16:46:02 -08:00
Sahil Batra 0df7bd71f3 CVE-2024-21630: Check permission to subscribe others using invite link.
This commit updates the API to check the permission to subscribe other
users while creating multi-use invites. The API will raise error if
the user passes the "stream_ids" parameter (even when it contains only
default streams) and the calling user does not have permission to
subscribe others to streams.

We did not add this before as we only allowed admins to create
multiuse invites, but now we have added a setting which can be used
to allow users with other roles as well to create multiuse invites.
2024-01-24 16:46:02 -08:00
Mateusz Mandera bfcde65449 docs: Add documentation for the new custom auth wrapper setting.
(cherry picked from commit 5c8d588b52)
2024-01-24 16:38:46 -08:00
Sahil Batra 0ebe623b42 group_settings: Empty right panel based on the url hash.
This commit adds code to empty the right panel if hash is
changed to "#groups/your" or "#groups/all".

(cherry picked from commit fc8e6d2aa8)
2024-01-24 16:38:46 -08:00
Sahil Batra 8549e9b648 groups_settings: Fix browser back button for groups overlay.
There is no problem in behavior of browser back button if we open
the group settings overlay using "#groups/your", "#groups/all" or
"#groups/new" url hash, but someone can directly go to a link with
"#groups" and in this case we want to fix the browser back button.

This commit replaces "#groups" entry with "#groups/your" which is the
default section opened, such that pressing back when on "#groups/your"
does not go to "#groups", which will then a form a cycle and instead
go back actually.

(cherry picked from commit c6be850fb9)
2024-01-24 16:38:46 -08:00
Sahil Batra 9a04f5b0c4 gear_menu: Open group settings overlay with "#groups/your" hash.
This commit fixes the bug in browser back button behavior when
opening the groups overlay from gear menu. The bug was caused
due to browser history containing both "#groups" and "#groups/your"
entries, which essentially resulted in a "#groups/your" -> "#groups"
-> "#groups/your" cycle and thus nothing happend on clicking
browser back button.

The case for a user manually typing "#groups" url would be handled
in next commit.

(cherry picked from commit eced3d9d6a)
2024-01-24 16:38:46 -08:00
Sahil Batra c8fe3d941c groups_settings: Make "Cancel" button work in group creation form.
(cherry picked from commit 3549164827)
2024-01-24 16:38:46 -08:00
Alex Vandiver fcef73fbbf import: Rewrite "delivered_message" column of scheduled messages.
This also requires shuffling the message import to before the
scheduled messages.

Fixes: #28690.
(cherry picked from commit c974b421e3)
2024-01-24 16:38:46 -08:00
Tim Abbott 5b98636e1e i18n: Update translation data from Transifex. 2024-01-24 11:47:18 -08:00
Alex Vandiver eac2fe6b81 import: Merge duplicate slack email addresses.
It is possible to have multiple users with the same email address --
for instance, when two users are guests in shared channels via two
different other Slack instances.

Combine those Slack user-ids into one Zulip user, by their user-id;
otherwise, we run into problems during import due to duplicate keys.

(cherry picked from commit 937e41bac8)
2024-01-22 18:19:09 -08:00
Alex Vandiver 4d465cb698 import: Show slack user-ids.
(cherry picked from commit e41810c0b3)
2024-01-22 18:19:09 -08:00
Alex Vandiver 57800e85c7 import: Support shared users in huddles/DMs.
1e5c49ad82 added support for shared channels -- but some users may
only currently exist in DMs or MPIMs, and not in channel membership.

Walk the list of MPIM subscriptions and messages, as well as DM users,
and add any such users to the set of mirror dummy users.

(cherry picked from commit 516d1083db)
2024-01-22 18:19:09 -08:00
Tim Abbott ddc88d2a45 compose: Simplify convert_mentions_to_silent_in_direct_messages.
The behavior to replace existing message content was leftover code
from a previous version of the mechanism, and not intended.

(cherry picked from commit 85ee5255bc)
2024-01-22 18:19:09 -08:00
Tim Abbott e332f4f4f2 compose: Don't convert bot mentions to silent mentions.
This fixes an unintended consequence of the silent mention conversion
logic added in 4d1ade1f88, where bots
that looked for personal mentions would not process mentions in 1:1
DMs.

(cherry picked from commit 60afdc45eb)
2024-01-22 18:19:09 -08:00
N-Shar-ma dfb4fc4261 compose: Revamp and improve test suite for compose formatting buttons.
Earlier, the tests for compose formatting were verbose, hard to read as
well as extend, and overly granular, without even having the ability to
test the final text selection or the cursor position.

Now, new test helpers, `init_textarea_state` and `get_textarea_state`,
have been added, enabling the tests to be more concise and readable,
while also being more powerful. A representative string alone now
describes the textarea state (the text and the selection / cursor),
making each test case as easy as defining the initial state as a string
and comparing the expected state post formatting with another string.

These new tests helped surface a couple bugs which have been fixed in
preceding commits.

(cherry picked from commit 179e9374b4)
2024-01-22 18:19:09 -08:00
N-Shar-ma c4d567c792 compose: Fix bug where toggling off link formatting left extra spaces.
In cases where either the description or the URL, or both were empty,
there would be an unneeded space, originally intended to space out the
description and URL, lingering even when the description and/or URL was
missing. The resulting highlight would also be off at times.

Now we only add in a space if both the description and URL are present,
and the highlight too is as intended.

(cherry picked from commit a5889bc3af)
2024-01-22 18:19:09 -08:00
N-Shar-ma b1fcbfd89a compose: Fix bug where spoiler would not always start on a new line.
Earlier, when a selection not starting at the beginning of a line was
formatted as a spoiler, the spoiler would not start on a new line, and
so would not be rendered as a spoiler. The `Header` highlighting too
was off by one character.

Now, the spoiler starts on a new line, and the `Header` highlighting
works as expected too.

(cherry picked from commit c46375f6fc)
2024-01-22 18:19:09 -08:00