mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
realm/playground: Add API endpoint for deleting a playground entry.
Similar to the previous commit, we have added a `do_*` function
which does the deletion from the DB. The next commit handles sending
the events when both adding and deleting a playground entry.
Added the openAPI format data to zulip.yaml for DELETE
/realm/playgrounds/{playground_id}. Also added python and curl
examples to remove-playground.md.
Tests added.
This commit is contained in:
@@ -14,6 +14,7 @@ from django.utils.timezone import now as timezone_now
|
||||
from zerver.lib.actions import (
|
||||
do_add_linkifier,
|
||||
do_add_reaction,
|
||||
do_add_realm_playground,
|
||||
do_create_user,
|
||||
update_user_presence,
|
||||
)
|
||||
@@ -277,6 +278,19 @@ def add_realm_playground() -> Dict[str, object]:
|
||||
}
|
||||
|
||||
|
||||
@openapi_param_value_generator(["/realm/playgrounds/{playground_id}:delete"])
|
||||
def remove_realm_playground() -> Dict[str, object]:
|
||||
playground_info = dict(
|
||||
name="Python playground",
|
||||
pygments_language="Python",
|
||||
url_prefix="https://python.example.com",
|
||||
)
|
||||
playground_id = do_add_realm_playground(get_realm("zulip"), **playground_info)
|
||||
return {
|
||||
"playground_id": playground_id,
|
||||
}
|
||||
|
||||
|
||||
@openapi_param_value_generator(["/users/{user_id}:delete"])
|
||||
def deactivate_user() -> Dict[str, object]:
|
||||
user_profile = do_create_user(
|
||||
|
||||
Reference in New Issue
Block a user