fix: Refactor collection exports to not send email attachment (#2460)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@ -6,7 +6,7 @@ import Collection from "models/Collection";
|
||||
import Button from "components/Button";
|
||||
import Flex from "components/Flex";
|
||||
import HelpText from "components/HelpText";
|
||||
|
||||
import useToasts from "hooks/useToasts";
|
||||
type Props = {
|
||||
collection: Collection,
|
||||
onSubmit: () => void,
|
||||
@ -15,6 +15,7 @@ type Props = {
|
||||
function CollectionExport({ collection, onSubmit }: Props) {
|
||||
const [isLoading, setIsLoading] = React.useState();
|
||||
const { t } = useTranslation();
|
||||
const { showToast } = useToasts();
|
||||
|
||||
const handleSubmit = React.useCallback(
|
||||
async (ev: SyntheticEvent<>) => {
|
||||
@ -23,9 +24,12 @@ function CollectionExport({ collection, onSubmit }: Props) {
|
||||
setIsLoading(true);
|
||||
await collection.export();
|
||||
setIsLoading(false);
|
||||
showToast(
|
||||
t("Export started, you will receive an email when it’s complete.")
|
||||
);
|
||||
onSubmit();
|
||||
},
|
||||
[collection, onSubmit]
|
||||
[collection, onSubmit, showToast, t]
|
||||
);
|
||||
|
||||
return (
|
||||
@ -33,7 +37,7 @@ function CollectionExport({ collection, onSubmit }: Props) {
|
||||
<form onSubmit={handleSubmit}>
|
||||
<HelpText>
|
||||
<Trans
|
||||
defaults="Exporting the collection <em>{{collectionName}}</em> may take a few seconds. Your documents will be downloaded as a zip of folders with files in Markdown format."
|
||||
defaults="Exporting the collection <em>{{collectionName}}</em> may take a few seconds. Your documents will be a zip of folders with files in Markdown format. Please visit the Export section on settings to get the zip."
|
||||
values={{ collectionName: collection.name }}
|
||||
components={{ em: <strong /> }}
|
||||
/>
|
||||
|
Reference in New Issue
Block a user