Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
realm_export: Return export id from POST which create it.
Alex Vandiver3160c3cce0ef
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex fb82a8d988e..834b2121a1d 100644--- a/api_docs/changelog.md+++ b/api_docs/changelog.md@@ -20,6 +20,11 @@ format used by the Zulip server that they are interacting with.## Changes in Zulip 7.0+**Feature level 182**++* `POST /export/realm`: This endpoint now returns the ID of the data+ export object created by the request.+**Feature level 181*** [`GET /scheduled_messages`](/api/get-scheduled-messages), [`GETdiff --git a/version.py b/version.pyindex b7575017efa..c772168cbbb 100644--- a/version.py+++ b/version.py@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"# Changes should be accompanied by documentation explaining what the# new level means in api_docs/changelog.md, as well as "**Changes**"# entries in the endpoint's documentation in `zulip.yaml`.-API_FEATURE_LEVEL = 181+API_FEATURE_LEVEL = 182# Bump the minor PROVISION_VERSION to indicate that folks should provision# only when going from an old version of the code to a newer version. Bumpdiff --git a/zerver/tests/test_realm_export.py b/zerver/tests/test_realm_export.pyindex 4129c6608e7..783f9e0804d 100644--- a/zerver/tests/test_realm_export.py+++ b/zerver/tests/test_realm_export.py@@ -159,7 +159,7 @@ class RealmExportTest(ZulipTestCase):result = self.client_post("/json/export/realm")self.assertTrue("INFO:root:Completed data export for zulip in " in info_logs.output[0])mock_export.assert_called_once()- self.assert_json_success(result)+ data = self.assert_json_success(result)self.assertFalse(os.path.exists(tarball_path))# Get the entry and test that iago initiated it.@@ -167,6 +167,7 @@ class RealmExportTest(ZulipTestCase):event_type=RealmAuditLog.REALM_EXPORTED).first()assert audit_log_entry is not None+ self.assertEqual(audit_log_entry.id, data["id"])self.assertEqual(audit_log_entry.acting_user_id, admin.id)# Test that the file is hosted, and the contents are as expected.@@ -226,14 +227,15 @@ class RealmExportTest(ZulipTestCase):)mock_export.assert_called_once()# This is a success because the failure is swallowed in the queue worker- self.assert_json_success(result)+ data = self.assert_json_success(result)+ export_id = data["id"]# Check that the export shows up as failedresult = self.client_get("/json/export/realm")response_dict = self.assert_json_success(result)export_dict = response_dict["exports"]self.assert_length(export_dict, 1)- export_id = export_dict[0]["id"]+ self.assertEqual(export_dict[0]["id"], export_id)self.assertEqual(export_dict[0]["pending"], False)self.assertIsNone(export_dict[0]["export_url"])self.assertIsNone(export_dict[0]["deleted_timestamp"])diff --git a/zerver/views/realm_export.py b/zerver/views/realm_export.pyindex 2911c92ce96..40a4b717dd7 100644--- a/zerver/views/realm_export.py+++ b/zerver/views/realm_export.py@@ -85,7 +85,7 @@ def export_realm(request: HttpRequest, user: UserProfile) -> HttpResponse:"id": row.id,}transaction.on_commit(lambda: queue_json_publish("deferred_work", event))- return json_success(request)+ return json_success(request, data={"id": row.id})@require_realm_admin