Commit Graph

56456 Commits

Author SHA1 Message Date
David Rosa 8bddaf8df6 help: Fix "contact us" link in the footer of documentation pages. 2024-02-06 18:22:57 -08:00
Tim Abbott c3208c73a1 docs: Update GSoC page based on feedback. 2024-02-06 18:18:07 -08:00
Lauryn Menard 6818a09123 remote-support: Add server mobile users without a remote realm.
Adds a count for mobile users registered for the remote server
with a RemotePushDeviceToken that does not have an associated
remote realm, which was a recently added field.

If the remote server is pre-8.0 and does not have remote realms,
then only the total mobile user count is displayed, as the count
for uncatagorized mobile users would be equal to the total mobile
user count.
2024-02-06 18:09:45 -08:00
Lauryn Menard 4f04f9f1f0 remote-support: Show datetime of last mobile push forwarded count.
This is useful for support admin to know if push notifications for
the remote server or realm have recently been logged/counted.
2024-02-06 18:09:45 -08:00
Lauryn Menard 5479053a9f remote-support: Add server data for last audit log update time.
This is useful in the support view in case the audit log data is
stale and user counts are not updated for billing.

Also, renames formatting function for optional datetimes that is
used in the support and activity views/charts. And instead of
showing these datetime strings in the eastern US timezone, we
now show and label them as UTC.
2024-02-06 18:09:45 -08:00
Tim Abbott 51542eb55e stats: Fix bad query plan for remote counts.
We don't have an index on `(server_id, id)`, and in any case, we have
a stronger guarantee that `remote_id` is time-sorted, from the
construction of the analytics tables, than that the `id`s given these
entries when uploaded are time-sorted.
2024-02-06 18:06:17 -08:00
Alex Vandiver b23d90ed62 puppet: Rename puppet/zulip_ops to puppet/kandra.
This makes for easier tab-completion, and also is a bit more explicit
about the expected consumer.
2024-02-06 17:56:27 -08:00
Tim Abbott f4ad102d39 narrow_state: Add pm_ids_set helper.
This provides a more easy to work with model of which users, if any,
are involved in the current DM conversation, if any.
2024-02-06 14:44:09 -08:00
Tim Abbott 772ed724c0 peer_data: Extend get_subscriber_count to allow excluding bots.
The new buddy list code path will want to be able to do this.
2024-02-06 14:44:09 -08:00
evykassirer a46c4f7b7e people: Gracefully fail for invalid users in user_is_bot.
Many of these code paths largely expect it to be a valid user ID, so
we could raise an exception if the user ID is invalid, but probably
gracefully proceeding is reasonable for the callers.
2024-02-06 14:44:09 -08:00
Alex Vandiver ccc106dca3 puppet: Add redis host to ~redistunnel/.ssh/known_hosts. 2024-02-06 11:34:09 -08:00
Alex Vandiver aaf3eb514d puppet: Allow controlling known_hosts.
Note that this uses `ssh-keyscan` to write in the currently-observed
host fingerprint; if DNS or network is untrusted during initial puppet
apply, this can allow attackers to write their own host key, obviating
the utility of known_hosts.

We do not view this as a likely attack mechanism, since in our
deployment the network and DNS is almost certainly trusted, and if
not, the timing attack to catch only initial configuration is likely
impossible.
2024-02-06 11:34:09 -08:00
Prakhar Pratyush c54fa91f1a do_send_messages: Remove the stale 'email_gateway' parameter.
This commit removes the stale 'email_gateway' parameter
from 'do_send_messages' function.

This should have been removed in 6c473ed75f,
when the call to 'build_message_send_dict' was removed
from 'do_send_messages'.
2024-02-05 23:19:13 -08:00
Tim Abbott f55ee266b7 message_list_view: Ensure render window IDs are integers.
The previous logic threw confusing exceptions if, during
testing/debugging, one picked an odd render window size.
2024-02-05 23:17:43 -08:00
Tim Abbott a8698c08ca navigate: Correct handling of limited fetched content.
This correctly avoids pageup/pagedown scrolling past already rendered
content, while also always making progress, which the previous logic
introduced in d8ec141de2 might do, at
least in degenerate cases with very small render windows.

I'm not sure this change has any effect in practice with current
render window values, but it does fix a bug if I set the maximum
render window size to 20.
2024-02-05 23:17:43 -08:00
Tim Abbott b9af5ce86e unread: Fix process_visible race with fetching.
The previous batch of improvements to this code path in
6562ea94e4 introduced a race bug where:

- You navigate to a narrowed view; Zulip renders cached data from
  `all_messages_data` that we know is current, but
  `fetch_status.has_found_newest` is initialized to `false`
  nonetheless.

- The bottom is visible, triggering the check for whether the view
  should be marked as read.

- `fetch_status.has_found_newest` is still `false`, and so we
  incorrectly refuse to mark as read.

- We finish fetching data from the server, do the background rerender
  for that (with no changes), but that doesn't trigger a re-check for
  whether the bottom is visible.

There's several ways to address this, but most correct to me is to not
check fetch_status in this particular code path.

The same reasoning applies to the navigate.js call sites.
2024-02-05 23:17:43 -08:00
Tim Abbott b8562bf7b4 docs: Update main GSoC page. 2024-02-05 17:51:23 -08:00
Anders Kaseorg 029e765e20 openapi: Validate real requests and responses, not fictional mocks.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg 5cac872e4b openapi: Get parameters from requestBody too.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg a67d1b57b9 openapi: Use Parameter class for generating curl examples.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg 131b230e2b openapi: Represent OpenAPI parameters with a Parameter class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg 0cee3bee00 openapi: Remove confusing check for 200 responses.
This error message didn’t make sense for the check as written, and our
OpenAPI document already provides the expected format for our 200
responses.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg bb699f7ee3 test_openapi: Provide missing defs_mapping argument.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg 0514f92bdb openapi: Loosen anchor parameter specification to string.
Real requests would not validate against the previous version.  There
seems to be no consistent way to determine whether a string parameter
should be coerced to an integer for validation against an allOf
schema (which works at the level of JSON objects, not strings).

See also https://github.com/python-openapi/openapi-core/issues/698.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg 0dd92d2116 test_classes: Add Content-Type header to empty DELETE/POST bodies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg a356ec7011 test_classes: Default client_post to application/x-www-form-urlencoded.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg d9f2f23c6a requirements: Upgrade to openapi-core pre-release.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
Anders Kaseorg 41f253774d Revert "zproject: Prevent having exactly 17/18 middlewares, for Python 3.11 bug."
This reverts commit cf0b803d50.
2024-02-05 19:57:21 -05:00
Anders Kaseorg 4f27381ebc ci: Disable coverage on Debian 12.
This is probably a more effective workaround for
https://github.com/python/cpython/issues/106092.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-05 19:57:21 -05:00
roanster007 49e3e6da06 timerender: Fix get_timestamp_for_flatpickr when no parameter passed.
Previously, when no parameter was passed to the get_timestamp_for_
flatpickr method, it would result in an uncaught exception. This is
breaking the "Add global time" of compose bar.

This can be avoided by doing an early return of current time to hour
in case no string is passed.
2024-02-05 12:33:39 -08:00
roanster007 d971b36026 timerender: Extract get_current_time_to_hour helper.
We will reuse this in the next commit.
2024-02-05 12:33:13 -08:00
Alex Vandiver fe1fd30a58 puppet: Create redistunnel group.
This was left off of 1fe5e7c7da.
2024-02-05 12:15:15 -08:00
Aman Agrawal 37b0f59200 reactions: Rename `get_reaction_section`.
We pluralize it to indicate that it can return multiple row from
multiple lists / rows.
2024-02-05 11:06:46 -08:00
Aman Agrawal c436b8011f message_list_view: Use `$()` to create an empty jQuery object. 2024-02-05 11:06:46 -08:00
Aman Agrawal 7463f561f1 echo: Track if we are showing slow spinner for a message. 2024-02-05 11:06:46 -08:00
Aman Agrawal 8acbf02ad7 reactions: Fix reactions not displayed in all messages view.
We were not updating all the rendered `messages-rows` but just
for the current view.

This bug was introduced in
df180f7bd5
2024-02-05 11:06:46 -08:00
Lauryn Menard cbb6d962d5 stripe: Add billing address collection to checkout session.
This will require customers to include an address when setting
up, or updating, the credit card information for their account.
The billing address for the card will also be saved as the
billing address for the stripe customer object.

The customer object billing address appears on the invoices
that are generated by stripe.
2024-02-05 10:16:04 -08:00
Aman Agrawal f71337aaf7 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.
2024-02-05 08:51:10 -08:00
Alex Vandiver 437361de32 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
2024-02-05 08:42:29 -08:00
Tim Abbott 67ed87ecb5 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.
2024-02-04 17:38:56 -08:00
Tim Abbott e91748022f 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.
2024-02-04 17:38:56 -08:00
Tim Abbott 624e1a85ce 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.
2024-02-04 17:38:56 -08:00
Tim Abbott 370afd6464 reload: Add on-focus handler after a delay. 2024-02-04 17:38:56 -08:00
Tim Abbott 5f4e1de661 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.
2024-02-04 17:38:56 -08:00
Aman Agrawal de33aa4b7b stripe: Add page to show list of past customer invoices. 2024-02-04 17:38:24 -08:00
Tim Abbott d8ec141de2 navigate: Fix buggy detection of start/end.
I was not able to reproduce obviously badly broken behavior from these
logic bugs, but after the renaming of message_viewport helpers in the
last few commits, it's clear that this logic was trying to check if
we're actually at the start/end of the possibly message feed, not just
the rendered portion, and doing so incorrectly.
2024-02-04 17:34:24 -08:00
Tim Abbott 4f8da7462d message_scroll: Add some explanatory comments. 2024-02-04 17:34:24 -08:00
Tim Abbott 84ec491e34 message_viewport: Rename at_top for clarity. 2024-02-04 17:34:24 -08:00
Tim Abbott 42956e0305 message_viewport: Rename at_bottom for clarity. 2024-02-04 17:34:24 -08:00
Tim Abbott 45f9bd21e5 message_viewport: Rename bottom_message_visible. 2024-02-04 17:34:24 -08:00