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: Add instructions to help customers with large export size.

Aman Agrawal82a8f6fd357f
diff --git a/templates/zerver/slack_import.html b/templates/zerver/slack_import.html
index 0c482677a8d..780c752dc14 100644
--- a/templates/zerver/slack_import.html
+++ b/templates/zerver/slack_import.html
@@ -68,6 +68,7 @@
{% trans %}
Follow <a href="https://zulip.com/help/import-from-slack#export-your-slack-data" target="_blank" rel="noopener noreferrer">these instructions</a> to obtain your Slack message history export.
{% endtrans %}
+ {% include "zerver/slack_import_file_upload_instruction.html" %}
</div>
<button class="slack-import-upload-file full-width">{{ _('Start upload') }}</button>
</div>
diff --git a/templates/zerver/slack_import_file_upload_instruction.html b/templates/zerver/slack_import_file_upload_instruction.html
new file mode 100644
index 00000000000..16872bc0a0e
--- /dev/null
+++ b/templates/zerver/slack_import_file_upload_instruction.html
@@ -0,0 +1,11 @@
+<p class="slack-import-file-upload-instruction">
+ {% if corporate_enabled %}
+ {% trans %}
+ Maximum size: {{max_file_size}} MiB. For larger exports, follow the <a href="/help/import-from-slack#import-your-data-into-zulip" rel="noopener noreferrer" target="_blank">process</a> for imports via support.
+ {% endtrans %}
+ {% else %}
+ {% trans %}
+ Maximum size: {{max_file_size}} MiB. For larger exports, follow the <a href="/help/import-from-slack#import-your-data-into-zulip" rel="noopener noreferrer" target="_blank">process</a> for self-hosted imports.
+ {% endtrans %}
+ {% endif %}
+</p>
diff --git a/web/src/portico/slack-import.ts b/web/src/portico/slack-import.ts
index aec4b06b8b1..e6cfda591d5 100644
--- a/web/src/portico/slack-import.ts
+++ b/web/src/portico/slack-import.ts
@@ -9,6 +9,9 @@ import {$t} from "../i18n.ts";
$(() => {
if ($("#slack-import-dashboard").length > 0) {
+ const max_file_upload_size_mib = Number(
+ $("#slack-import-dashboard").attr("data-max-file-size"),
+ );
const key = $<HTMLInputElement>("#auth_key_for_file_upload").val();
const uppy = new Uppy({
autoProceed: true,
@@ -16,6 +19,7 @@ $(() => {
maxNumberOfFiles: 1,
minNumberOfFiles: 1,
allowedFileTypes: [".zip", "application/zip"],
+ maxFileSize: max_file_upload_size_mib * 1024 * 1024,
},
meta: {
key,
@@ -25,6 +29,10 @@ $(() => {
youCanOnlyUploadFileTypes: $t({
defaultMessage: "Upload your Slack export zip file.",
}),
+ exceedsSize: $t({
+ defaultMessage:
+ "Uploaded file exceeds maximum size for self-serve imports.",
+ }),
},
// Copied from
// https://github.com/transloadit/uppy/blob/d1a3345263b3421a06389aa2e84c66e894b3f29d/packages/%40uppy/utils/src/Translator.ts#L122
@@ -40,6 +48,8 @@ $(() => {
});
uppy.use(Dashboard, {
target: "#slack-import-dashboard",
+ // This will be replace by an HTML note after being mounted.
+ note: "...",
});
uppy.use(Tus, {
endpoint: "/api/v1/tus/",
@@ -61,6 +71,14 @@ $(() => {
$("#slack-import-file-upload-error").text("");
$("#realm-creation-form-slack-import .register-button").prop("disabled", false);
});
+ uppy.on("dashboard:modal-open", () => {
+ // Replace the note with the actual content after the dashboard is mounted.
+ $(".uppy-Dashboard-note").text(
+ $t({
+ defaultMessage: "Upload your Slack export zip file.",
+ }),
+ );
+ });
$(".slack-import-upload-file").on("click", (e) => {
e.preventDefault();
diff --git a/web/styles/portico/portico_signin.css b/web/styles/portico/portico_signin.css
index ed1b8aae4ee..bc08dccdd69 100644
--- a/web/styles/portico/portico_signin.css
+++ b/web/styles/portico/portico_signin.css
@@ -1675,3 +1675,13 @@ button#register_auth_button_gitlab {
#new-realm-creation #altcha-submit-button-container {
margin-bottom: 30px;
}
+
+#slack-import-dashboard .uppy-Dashboard-note {
+ font-size: 1rem;
+ font-weight: 450;
+ color: inherit;
+}
+
+.slack-import-file-upload-instruction {
+ margin-top: 1rem;
+}