Commit Graph

160 Commits

Author SHA1 Message Date
Vector73 9e4e85e140 saved_snippets: Add backend for saved snippets.
Part of #31227.
2024-09-24 15:27:58 -07:00
Prakhar Pratyush 86194efe7b realm_export: Add a new endpoint to fetch private data export consents.
This commit adds a new endpoint `export/realm/consents` to
fetch the consents of users for their private data exports.

Fixes part of #31201.
2024-09-20 09:10:32 -07:00
Sahil Batra 5f3a8334be user_groups: Do not allow deleting user groups. 2024-09-18 13:41:13 -07:00
joseph 65893292b5 channel_subscribe: Use IDs instead of emails when processing results.
As part of our todo in the code, we want to use the unique user IDs
instead of emails when processing the results of subscribing users to a
channel. These changes apply those changes and streamlines the use of IDs.
2024-09-10 15:37:38 -07:00
Vector73 b0bd13207d api_docs: Document "/export/realm" endpoints. 2024-08-12 10:12:08 -07:00
Vector73 d21ee6fa23 api: Deprecate uri and add url parameter in "/user_uploads" endpoint. 2024-07-14 22:32:36 -07:00
Anders Kaseorg 0fa5e7f629 ruff: Fix UP035 Import from `collections.abc`, `typing` instead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg e08a24e47f ruff: Fix UP006 Use `list` instead of `List` for type annotation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Vector73 5230aada2b python_examples: Validate error responses.
Adds assert statements to validate error response for "400" error code. The
current validation using `validate_against_openapi_schema` doesn't work for
"400" responses.

Adds separate functions to validate "200" and "400" responses and removes `validate_response_result`.
2024-06-21 09:49:07 -07:00
Vector73 faa06497ed api_docs: Document "/invites/{invite_id}/resend" endpoint. 2024-06-10 11:48:39 -07:00
Vector73 d60150d39d api_docs: Document "/users/me/presence" endpoint.
Co-authored-by: Tim Abbott <tabbott@zulip.com>
Co-authored-by: Mateusz Mandera <mateusz.mandera@zulip.com>
2024-06-07 14:28:54 -07:00
Vector73 c514d39efc python-examples: Remove unneeded asserts of parameter type. 2024-06-03 10:04:48 -07:00
Vector73 daf49c82e1 python-examples: Make spacing consistent in file for readability. 2024-06-03 10:04:48 -07:00
Vector73 f46b49c79c python-examples: Clean up inline comments. 2024-06-03 10:04:48 -07:00
Lauryn Menard 9fd21addad python-examples: Move variable assignment out of user-facing examples. 2024-06-03 10:04:48 -07:00
Lauryn Menard 265f85fa95 python-examples: Remove unused result variable assigments. 2024-06-03 10:04:48 -07:00
Lauryn Menard 0584b9b2cf python-examples: Get invite IDs for tests that revoke invitations. 2024-06-03 10:04:48 -07:00
Lauryn Menard 6ef1625050 python-examples: Clean up user IDs in tests. 2024-06-03 10:04:48 -07:00
Vector73 1d3e4307fa python_examples: Add assert statements to verify response.
Creates a helper function `validate_response_result` to verify the
response of API request for each test.
2024-06-03 10:04:48 -07:00
Vector73 dde385a8e4 python_examples: Fix inconsistencies related to schema validation. 2024-06-03 10:04:48 -07:00
Vector73 f3bac5e3a3 python_examples: Update comment and remove unnecessary assert. 2024-06-03 10:04:48 -07:00
Vector73 1c3ba864e9 py_examples: Refactor `filters` tests to pass filter_id as parameter.
Updates `*_realm_filter` functions to use `filter_id` from function
argument rather than a hardcoded value.
2024-06-03 10:04:48 -07:00
Vector73 bea6f0370e python_examples: Refactor tests to remove hardcoded values.
Creates a helper function `get_subscribed_stream_ids` to fetch
subscribed streams' ids of the client.

Updates various functions to remove hardcoded values in request
body and used available API calls to fetch them.
2024-06-03 10:04:48 -07:00
Vector73 e4a1ff655c python_examples: Create helper function to remove repeated code.
Creates a helper function `validate_message` to remove the repeated code
for verifying the sent messages.
2024-06-03 10:04:48 -07:00
Vector73 62dfd93a83 api: Add "users/<int:user_id>/status" endpoint.
The documentation Creates a shared UserStatus schema that's used for
the return value of this new endpoint and for the existing user_status
objects returned by the register queue endpoint.

Co-authored-by: Suyash Vardhan Mathur <suyash.mathur@research.iiit.ac.in>

Fixes #19079.
2024-05-22 18:07:22 -07:00
Lauryn Menard c3577d9cdd api-docs: Update python example user-facing comments for channel.
Updates python usage example comments, which are user-facing, to
use channel instead of stream.

Part of the stream to channel rename project.
2024-05-20 11:30:25 -07:00
Lauryn Menard 016ffd8078 api-docs: Update python tests to not use "stream" in channel name.
Updates the channel names in python example tests to use "-channel"
instead of "_stream".

Part of stream to channel rename project.
2024-05-20 11:27:03 -07:00
Lauryn Menard c77c37be27 api-docs: Rename user-facing python example channel to "python-test".
Renames the test channel created and used in python usage examples
to "python-test" instead of "new stream".

Part of stream to channel rename project.
2024-05-20 11:27:03 -07:00
Lauryn Menard deec077925 api-docs: Update python usage example for archive_stream.
Even though there was a stream/channel ID being passed to the test
function for archive_stream, it wasn't being used in the test as
it was reset to a new stream created/subscribed in the function.

Updates the test function to remove the unused stream/channel ID
parameter, and updates the usage example for to use channel instead
of stream where appropriate.

Part of stream to channel rename project.
2024-05-20 11:27:03 -07:00
Lauryn Menard 7644c83cca api-docs: Update narrow usage examples for get_messages.
Updates narrow parameters in the javascript and python usage
examples for the get_messages endpoint to use the "channel"
operator instead of the "stream" operator.

Part of the stream to channel rename project.
2024-05-20 11:27:03 -07:00
Tim Abbott 1d52d08803 api_examples: Fix failing invitation links test.
This system is too fragile with hardcoded IDs; we should be asserting
that the preparatory requests succeeded to make these easier to debug.
2024-05-15 15:01:08 -07:00
Vector73 431beae96f api_documentation: Document "/invites/multiuse/{invite_id}" endpoint. 2024-05-15 12:05:40 -07:00
Vector73 9f8d738252 openapi: Document android_gcm_reg_id endpoints.
This commit adds API documentation for "/users/me/android_gcm_reg_id:post"
and "/users/me/android_gcm_reg_id:delete" endpoints.

Co-authored-by: Suyash Vardhan Mathur <suyash.mathur@research.iiit.ac.in>
2024-05-10 08:37:12 -07:00
Vector73 b047bf0d79 openapi: Document apns_device_token endpoints.
This commit adds API documentation for "/users/me/apns_device_token:post"
and "/users/me/apns_device_token:delete" endpoints.

openapi: Document android_gcm_reg_id endpoints.

Co-authored-by: Suyash Vardhan Mathur <suyash.mathur@research.iiit.ac.in>
2024-05-10 08:37:12 -07:00
Prakhar Pratyush ac2152fdfd onboarding: Replace channel messages in new organizations.
As a part of improving onboarding experience, this
commit updates the channels and messages initially
available in new orgs.

Fixes #29297.
2024-05-09 14:05:35 -07:00
Prakhar Pratyush 61e606f656 onboarding: Remove 'core team' private channel.
We no longer create the 'core team' private channel when
a realm is created.

Earlier, "New user announcements" channel was set to the
"core team" channel. Now it is disabled by default.

populate_db still creates the 'core team' channel to
represent a private channel.
2024-05-09 14:05:35 -07:00
Vector73 0f97733687 api_documentation: Document "/invites/{prereg_id}" endpoint. 2024-04-20 18:12:04 -07:00
Vector73 2734a9483b api_documentation: Document "/invites/multiuse" endpoint.
Adds "/invites/multiuse" endpoint to the API documentation.

Creates a shared schema for the invite_as and invite_expires_in_minutes
parameters that are the same for the "POST /invites" endpoint.

Also, updates the response documented for the "GET /invites" endpoint
to match the information in the "POST /invites" and "/invites/multiuse"
documentation.
2024-04-10 11:29:14 -07:00
Vector73 6af9a6635c api_docs: Fix "/invites" enpoint documentation. 2024-04-03 10:45:05 -07:00
Vector73 7a55bb218b api_documentation: Add "/invites" endpoint to the api documentation. 2024-04-01 13:16:31 -07:00
Anders Kaseorg cd96193768 models: Extract zerver.models.realms.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-12-16 22:08:44 -08:00
Anders Kaseorg 45bb8d2580 models: Extract zerver.models.users.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-12-16 22:08:44 -08:00
Prakhar Pratyush c520a96354 typing_indicator: Add a 'stream_id' parameter to 'POST /typing'.
This commit adds a 'stream_id' parameter to the 'POST /typing'
endpoint.

Now, 'to' is used only for "direct" type. In the case of
"stream" type, 'stream_id' and 'topic' are used.
2023-10-12 09:53:09 -07:00
Prakhar Pratyush e23f3ac89b typing_indicator: Update the 'to' parameter to accept stream ID.
When the `type` of the message being composed is "stream",
this commit updates the `to` parameter to accept the ID of
the stream in which the message is being typed.

Earlier, it accepted a single-element list containing the ID
of the stream.

Sending the element instead of a list containing the single element
makes more sense.
2023-10-10 17:15:28 -07:00
Zixuan James Li 37660dd0e7 linkifier: Support reordering linkifiers.
This adds API support to reorder linkifiers and makes sure that the
returned lists of linkifiers from `GET /events`, `POST /register`, and
`GET /realm/linkifiers` are always sorted with the order that they
should processed when rendering linkifiers.

We set the new `order` field to the ID with the migration. This
preserves the order of the existing linkifiers.

New linkifiers added will always be ordered the last. When reordering,
the `order` field of all linkifiers in the same realm is updated, in
a manner similar to how we implement ordering for
`custom_profile_fields`.
2023-08-14 15:21:48 -07:00
Zixuan James Li 011b4c1f7a populate_db: Populate linkifiers.
The curl examples of reordering linkifiers require there to be some
linkifiers in the database to be reordered. This adjusts some test cases
so they do not assume that there is no linkifier in the test db.
2023-08-14 15:21:48 -07:00
Anders Kaseorg 562a79ab76 ruff: Fix PERF401 Use a list comprehension to create a transformed list.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-07 17:23:55 -07:00
Zixuan James Li 000761ac0c realm_playgrounds: Replace url_prefix with url_template.
Dropping support for url_prefix for RealmPlayground, the server now uses
url_template instead only for playground creation, retrieval and audit
logging upon removal.

This does the necessary handling so that url_template is expanded with
the extracted code.

Fixes #25723.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-07-24 17:40:59 -07:00
Anders Kaseorg 3b09197fdf ruff: Fix RUF015 Prefer `next(...)` over single element slice.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-23 15:20:53 -07:00
Lalit a686c0cc02 docs: Add documentation for delete emoji endpoint.
This endpoint was previously marked as `intentionally_undocumented`
but that was mistake.

Removed `intentionally_undocumented` and added proper documentation
with valid `python_example` for this Endpoint.

Fixes: #24084
2023-06-28 10:23:47 -07:00