Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

slack_import: Fix unable check import progress from confirmation link.

Aman Agrawal3e3d09b9c77c
diff --git a/zerver/tests/test_slack_importer.py b/zerver/tests/test_slack_importer.py
index e7a747e7041..4f2489b26a2 100644
--- a/zerver/tests/test_slack_importer.py
+++ b/zerver/tests/test_slack_importer.py
@@ -2258,6 +2258,19 @@ by Pieter
},
)
+ # Test that clicking on the confirmation link redirects to status page
+ # which helps user resume the import process if they closed the tab.
+ result = self.client_get(confirmation_url)
+ self.assert_in_success_response(["new/import/slack"], result)
+ result = self.client_post(
+ "/new/import/slack/",
+ {
+ "key": confirmation_key,
+ "slack_access_token": access_token,
+ },
+ )
+ self.assert_in_success_response(["Import progress"], result)
+
# We don't want to test to whole realm import process here but only that
# realm import calls are made with correct arguments and different cases
# are handled well.
diff --git a/zerver/views/registration.py b/zerver/views/registration.py
index 7a67809aaaf..1df92349c1f 100644
--- a/zerver/views/registration.py
+++ b/zerver/views/registration.py
@@ -369,6 +369,15 @@ def registration_helper(
return HttpResponseRedirect(
reverse("realm_import_post_process", kwargs={"confirmation_key": key})
)
+ if prereg_realm.data_import_metadata.get("is_import_work_queued"):
+ return TemplateResponse(
+ request,
+ "zerver/slack_import.html",
+ {
+ "poll_for_import_completion": True,
+ "key": key,
+ },
+ )
# Set text of `EMAIL_ADDRESS_VISIBILITY_EVERYONE` to "Everyone" so that it doesn't overflow the
# select box in the slack import page.