Commit Graph

18426 Commits

Author SHA1 Message Date
Kenneth Rodrigues 387fba7156 custom_profile: Convert to typed_endpoint.
Convert `custom_profile_fields.py` to use `typed_endpoint`.

Use `TypedDict` from `typing_extensions` instead of `typing`,
to support Pydantic's type checking.
2024-06-19 18:29:28 -07:00
Lauryn Menard a9141f2277 api-docs: Update API feature level 36 rate limit error changes notes. 2024-06-19 17:49:02 -07:00
Lauryn Menard d0c25a9291 api-docs: Clarify error response keys and handling documentation.
Updates the main description of the API error handling article so
that the `code` key in the error reponse is more accurate.

Adds a bullet point to the API changelog for feature level 76 about
the `code` key being consistently in all error responses. This is
based on commit 8b9011dff8, which completed the migration to
JsonableError, at which point the API feature level was already
set to 75 and not yet set to 76.

Also, revises the other error related feature level 76 entries in
the API changelog.

Adds a header for  the common, shared error responses that are
documented on the error handling page, and updates those error
descriptions to include information about any extra fields and to
end with any changes notes.
2024-06-19 17:49:02 -07:00
Shubham Padia 9c3e03ba83 custom_profile_fields: Remove reduntant test code block.
We're updating all the fields later in `test_update` rendering
the block in question redundant.
2024-06-18 09:41:56 -07:00
Shubham Padia cf75007ed3 custom_profile_fields: Extract `display_in_profile_summary` tests.
The current `test_update` function is too long, we're extracting out
the tests for `display_in_profile_summary` related changes to make
it shorter.
2024-06-18 09:41:56 -07:00
Shubham Padia 8eeed08e80 custom_profile_fields: Extract `field_data` tests from `test_update`.
The current `test_update` function is too long, we're extracting out
the tests for `field_data` related changes to make it shorter.
2024-06-18 09:41:56 -07:00
Prakhar Pratyush c10ef38b32 docs: Add subsystem doc for 'Onboarding Steps'.
Fixes part of #30043.
2024-06-18 09:39:50 -07:00
Prakhar Pratyush 0d59ff8c96 docs: Remove 'Hotspots' subsystem doc.
We no longer have 'Hotspots' to introduce users
to important UI elements.

We now use one time banners for it.
2024-06-18 09:39:50 -07:00
Mateusz Mandera 4917e01ffb push_notifications: Migrate to FCM HTTP v1 API.
The legacy API we use via python-gcm is deprecated and about to be
disabled.

Fixes #29768.
2024-06-17 18:26:26 -07:00
Mateusz Mandera 496aa2a0f1 test_push_notifs: Remove gcm_client mock in test_connection_error.
This wasn't doing anything. The test simulates failure to connect to the
bouncer, so the codepaths inside the bouncer don't even get triggered.
2024-06-17 18:23:00 -07:00
Mateusz Mandera 2628af9ef4 test_push_notifs: Rename GCM->FCM in some var and func names. 2024-06-17 18:22:59 -07:00
Mateusz Mandera 297141f8c4 push_notifs: Rename parse_gcm_options to parse_fcm_options. 2024-06-17 18:22:59 -07:00
Mateusz Mandera 497be370f5 push_notifs: Rename GCM->FCM in a bunch of comments.
This is called FCM now, even though we're using the legacy API that used
to be called GCM.
2024-06-17 18:22:59 -07:00
Mateusz Mandera 9c10b0d700 push_notifs: Rename has_gcm_credentials to has_fcm_credentials. 2024-06-17 18:22:59 -07:00
Mateusz Mandera 00b8cce50e push_notifs: Rename PushDeviceToken.GCM to FCM. 2024-06-17 18:22:59 -07:00
Mateusz Mandera 4591202032 push_notifs: Remove "canonical" handling in FCM API.
We believe this to already be obsolete and dead code and is about to be
removed with the migration to the FCM HTTP v1 API, where the concept
doesn't exist anymore.
2024-06-17 18:22:59 -07:00
nimish 81ea09be19 search: Add is:followed filter.
Create the is:followed search operator.
Fetch all messages that are from followed topics
using exists.
Update API documentation and changelog.

Co-authored-by: Kenneth Rodrigues <kenneth.nrk123@gmail.com>

Fixes #27309.
2024-06-17 18:22:50 -07:00
Kenneth Rodrigues 4ac527d327 openapi yaml: Add followed enum to visibility_policy for user_topics. 2024-06-17 18:22:50 -07:00
Shubham Padia 8ab6e71593 settings: Unite user settings into a single panel.
Previously, there were three different sections for managing active
users, deactivated users and invitations.
This commit combines users section has into a single tabbed panel.

Fixes: #26949.

Co-authored-by: shashank-23002 <21bec103@iiitdmj.ac.in>
2024-06-17 17:16:21 -07:00
Shubham Padia e4c89771fd settings: Rename `user-list-admin` to `users`.
Renaming the url for better readability on the user's side.
We've also added a redirect for this, which will change the `section`
from `user-list-admin` to `users` whenever required.
See https://github.com/zulip/zulip/pull/30268#discussion_r1631539656
2024-06-17 17:16:21 -07:00
Prakhar Pratyush 5e42c8cd2b user_topics: Handle IntegrityError during bulk insertion.
When there was a race during bulk insertion of UserTopic
rows, it resulted in Integrity error.

We update the 'last_updated' and 'visibility_policy'
columns for conflicting rows.

We also removed the separate update query to update
visibility_policy because now the new SQL query can
handle the updates too. This leads to have fewer round
trips to the database.
2024-06-17 11:21:30 -07:00
Prakhar Pratyush 7754483c3f user_topics: Clean up the 'duplicate_request' variable.
In the 'bulk_set_user_topic_visibility_policy_in_database' function,
the 'duplicate_request' variable wasn't improving any readability.

This commit cleans up that variable.
2024-06-17 11:21:30 -07:00
Prakhar Pratyush 55a8bdfbd9 push_notifications: Use is_same_server_message_link lib function.
This commit replaces the local 'is_same_server_message_link'
function used in 'get_mobile_push_content' with the
'is_same_server_message_link' lib function.

The lib function is the same logically but uses urllib instead
of regex for parsing and is backed by tests, hence more robust.
2024-06-17 10:42:32 -07:00
Prakhar Pratyush 484befe9ce url_decoding: Add 'is_same_server_message_link' function.
This prep commit adds a lib function 'is_same_server_message_link'.

This will be currently used while compressing quote and reply
in push notifications and later can be used at other places.
2024-06-17 10:42:32 -07:00
Prakhar Pratyush 5fd676c4e0 test_fixtures: Add 'message_link_test_cases' test fixture.
This is a prep commit to extract out the test cases
for 'test_is_same_server_message_link' in hash_util.test.js
as a test fixture.

This will help in reusing the same test cases in the node and
backend tests.

Also, it will help in making sure that the logic for
'is_same_server_message_link' is in sync, in both the
web client and server code.
2024-06-17 10:42:32 -07:00
Mateusz Mandera 7ff1227984 presence: Improve INSERT conflict handling in do_update_user_presence.
This was discussed in the review of #29999:
https://github.com/zulip/zulip/pull/29999#discussion_r1620818568

The previous way of handling wasn't entirely correct, as unnecessary
events were omitted, with a bad guarantee of even being in the correct
order.

This is an improvement as now the function detects that it ended up
doing nothing and can skip sending an event.

The race condition is hard to make up in an automated test, but we can
hackily simulate it by injecting a side_effect which will create a
conflicting UserPresence row when the function requests a cursor. Aside
of that, the actual race was simulated in manual testing to verify the
expected behavior.
2024-06-16 11:57:47 -07:00
Sahil Batra ff8f797c5c test_event_system: Fix test_queries test.
Before this commit, 3 DB queries were actually needed for "realm"
event type but the test mentioned 1 because, the related stream
setting fields were already fetched when testing the case for all
event types above it.

So, when testing the query count for only "realm" event type the
cached realm object was used and no extra queries were made for
the stream settings.

This commit updates the test to refetch the realm before testing
each event type separately, so that we test the actual query count.
2024-06-16 11:55:28 -07:00
Sahil Batra e23af20079 realm: Prefetch group settings only for "/register" response.
This commit updates code to prefetch realm group settings like
"can_create_public_channel_group" only when computing settings
for "/register" response by refetching the realm object with
select_related instead of fetching those settings in UserProfile
query.

This change is done because we do not need to prefetch these
settings for every UserProfile object and for most of the cases
where these settings are actually accessed, we can afford extra
query like when checking permission to create streams. But we
cannot afford one query extra for each setting when computing
these settings for "/register" response, so we re-fetch the
realm object with select_related leading to only one extra
query.

The query count changes in tests are -
- Query count increases by 1 when calling fetch_initial_state_data
for computing can_create_public_streams because Realm object from
UserProfile does not have prefetched setting fields.

- Query count increases by one in test_subs where streams are
created which is as expected due to the setting not being prefetched.

- Query count increases by 2 in tests in test_home.py where one
query is to refetch the realm object and one for computing
can_create_public_streams as mentioned above.
2024-06-16 11:55:28 -07:00
Sahil Batra dea62a3fd9 events: Pass realm to fetch_initial_state_data always.
This commit makes passing realm mandatory to fetch_initial_state_data.

This is a prep commit for refetching the realm object with
select_related for group setting fields so that extra queries
can be avoided when computing "/registe" response.
2024-06-16 11:55:28 -07:00
Prakhar Pratyush de0c22592f push_notifications: Compress blockquotes when replying to a message.
To make better use of the limited characters in mobile push
notifications for messages quoting another message, we compress
the blockquotes and "user said" paragraphs to make space for the
actual message.

Fixes #28951.
2024-06-14 17:26:22 -07:00
Kenneth Rodrigues 07d0854ed3 storage: Migrate to typed_endpoint. 2024-06-14 11:24:36 -07:00
Kenneth Rodrigues 199d641fae onboarding: Migrate to typed_endpoint. 2024-06-14 11:24:36 -07:00
Kenneth Rodrigues 6364010df5 typing: Migrate to typed_endpoint. 2024-06-14 10:58:35 -07:00
Lauryn Menard 0bd2f0e545 api-docs: Extract logic for rendering events table and use templates.
Extracts code for generating the events table strings to a separate
function and uses templates so that the HTML is clearer.

Updates events table classes for CSS to start with "api-" for
clarity.
2024-06-14 10:29:53 -07:00
Lauryn Menard 963c871858 api-docs: Extract logic for generating individual event strings.
Creates a dataclass for getting the data needed for an individual
event's documentation and uses that dataclass in a separate
function for generating the strings for each event's documentation.

Uses templates for parts of event documentation with HTML and CSS,
and updates CSS classes to have clearer names.
2024-06-14 10:29:53 -07:00
Lauryn Menard b948217ade api-docs: Revise the "services" array and "config" object for bots.
Updates these descriptions to better fit current API documentation
conventions.
2024-06-14 10:27:01 -07:00
Lauryn Menard 9caf8b8b2b help: Update billing articles for current billing management features.
Updates the self-hosted and Zulip Cloud billing articles for features
that have been added to billing management such as paying by invoice,
adding billing contact information, viewing past invoices, etc.

Revises text to be cleaner and clearer in some places.

More consistently uses bold (when not linked) for plan names.

Fixes a few errors or omissions in existing instructions.

Co-authored-by: Alya Abbott <alya@zulip.com>
2024-06-13 07:00:39 -07:00
Vector73 e8a5cb99bf api_docs: Improve events table and fix font style of events title. 2024-06-13 06:53:51 -07:00
Lauryn Menard f13efbd6df api-docs: Clean up descriptions of can_mention_group user group setting. 2024-06-13 06:51:42 -07:00
Lauryn Menard dc67caa7bb api-docs: Remove extra "Changes:" in cases with multiple updates.
The general format for our bold "Changes:" notes are to have the
most recent one start with the "Changes:" text and the older notes
following that with paragraph breaks for each note.
2024-06-12 06:46:35 -07:00
Ryan Crisanti fc2aac6baa integration: Update topic & content of grafana webhook.
Sending to a topic based on the number of firing alerts makes no
sense, and leads to conversations and alerts scattered randomly across
topics based on how on fire the alerting is.

Send a separate message for each alert in the Grafana webhook payload,
with the alert's name as its topic; if no alert name can be found,
fall back to the alert's fingerprint.  Also include all alert values
in the body of the message, along with links to the alert generator,
silence, and image, if available.

Co-authored-by: Alex Vandiver <alexmv@zulip.com>
2024-06-12 06:44:14 -07:00
Alex Vandiver 18067794ae grafana: Rename fixtures to contain Grafana versions.
These are guessed, based on the shape of their contents and their
dates.
2024-06-12 06:44:14 -07:00
Vector73 f4c111b68a api_docs: Convert event names to lowercase in api docs. 2024-06-11 11:17:38 -07:00
Vector73 a4108e05ad api_docs: Add table of links for easy navigation in events api docs. 2024-06-11 11:17:38 -07:00
Gaurav Pandey 1c5007461a topic: Add resolve topic undo grace period.
Currently we send a notification to the topic if it has been resolved
or unresolved even if there is an immediate event of resolving and
then unresolving or vice-versa. This adds a setting of
RESOLVE_TOPIC_UNDO_GRACE_PERIOD_SECONDS under which if a topic has
been unresolved after being resolved immediately and the last message
was the notification of resolving, then delete the last message and
don't send a new notification and vice-versa.

We use the new message.type field to precisely identify relevant
messages.

Fixes #19181.

Co-authored-by: Mateusz Mandera <mateusz.mandera@zulip.com>
2024-06-10 13:34:23 -07:00
Tim Abbott 0232d97ae9 actions: Tag resolve topic messages with a message type.
This makes it possible for the server to distinguish these from other
messages.
2024-06-10 13:34:23 -07:00
Tim Abbott bb76bc316f models: Add message type field. 2024-06-10 13:34:23 -07:00
Sahil Batra 222995b1be settings: Remove create_public_stream_policy.
This commit removes create_public_stream_policy setting
since public channel creation permissions are now handled
by group-based setting.

We still pass "realm_create_public_stream_policy" in
"/register" response though for older clients with its
value being set depending on the value of group based
setting. If we cannot set its value to an appropriate
enum corresponding to the group setting, then we set
it to "Members only" considering that server will not
allow the users without permissions to create public
channels but the client can make sure that UI is
available to the users who have permission.
2024-06-10 12:24:45 -07:00
Sahil Batra 9365604c03 streams: Check permission to create streams based on group setting. 2024-06-10 12:24:45 -07:00
Sahil Batra 7655c69d89 realm: Set default for can_create_public_channel_group based on org type. 2024-06-10 12:24:45 -07:00