Put back default email using current user context in bulk document exports
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -37,7 +37,7 @@ type Props = {
|
|||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
onExport: (options: BulkExportFormData) => void;
|
onExport: (options: BulkExportFormData) => void;
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
defaultEmail?: string;
|
defaultEmail: string;
|
||||||
selectedCount: number;
|
selectedCount: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ export type BulkExportDialogRef = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const BulkExportDialog = forwardRef<BulkExportDialogRef, Props>(
|
export const BulkExportDialog = forwardRef<BulkExportDialogRef, Props>(
|
||||||
({ children, onExport, isLoading = false, defaultEmail = "", selectedCount }, ref) => {
|
({ children, onExport, isLoading = false, defaultEmail, selectedCount }, ref) => {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const dialogRef = useDialogRef();
|
const dialogRef = useDialogRef();
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import {
|
|||||||
usePreloadedQuery,
|
usePreloadedQuery,
|
||||||
type PreloadedQuery,
|
type PreloadedQuery,
|
||||||
} from "react-relay";
|
} from "react-relay";
|
||||||
import { useRef } from "react";
|
import { use, useRef } from "react";
|
||||||
import { graphql } from "relay-runtime";
|
import { graphql } from "relay-runtime";
|
||||||
import type { DocumentGraphListQuery } from "/__generated__/core/DocumentGraphListQuery.graphql";
|
import type { DocumentGraphListQuery } from "/__generated__/core/DocumentGraphListQuery.graphql";
|
||||||
import {
|
import {
|
||||||
@@ -55,6 +55,7 @@ import {
|
|||||||
BulkExportDialog,
|
BulkExportDialog,
|
||||||
type BulkExportDialogRef,
|
type BulkExportDialogRef,
|
||||||
} from "/components/documents/BulkExportDialog";
|
} from "/components/documents/BulkExportDialog";
|
||||||
|
import { CurrentUser } from "/providers/CurrentUser.tsx";
|
||||||
|
|
||||||
const documentsFragment = graphql`
|
const documentsFragment = graphql`
|
||||||
fragment DocumentsPageListFragment on Organization
|
fragment DocumentsPageListFragment on Organization
|
||||||
@@ -99,16 +100,6 @@ type Props = {
|
|||||||
queryRef: PreloadedQuery<DocumentGraphListQuery>;
|
queryRef: PreloadedQuery<DocumentGraphListQuery>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// const UserEmailQuery = graphql`
|
|
||||||
// query DocumentsPageUserEmailQuery {
|
|
||||||
// viewer {
|
|
||||||
// user {
|
|
||||||
// email
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// `;
|
|
||||||
|
|
||||||
export default function DocumentsPage(props: Props) {
|
export default function DocumentsPage(props: Props) {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
|
|
||||||
@@ -117,12 +108,7 @@ export default function DocumentsPage(props: Props) {
|
|||||||
props.queryRef,
|
props.queryRef,
|
||||||
).organization;
|
).organization;
|
||||||
|
|
||||||
// FIXME
|
const { email: defaultEmail } = use(CurrentUser)
|
||||||
// const userEmailData = useLazyLoadQuery<DocumentsPageUserEmailQuery>(
|
|
||||||
// UserEmailQuery,
|
|
||||||
// {}
|
|
||||||
// );
|
|
||||||
// const defaultEmail = userEmailData.viewer.user.email;
|
|
||||||
const pagination = usePaginationFragment(
|
const pagination = usePaginationFragment(
|
||||||
documentsFragment,
|
documentsFragment,
|
||||||
organization as DocumentsPageListFragment$key,
|
organization as DocumentsPageListFragment$key,
|
||||||
@@ -303,7 +289,7 @@ export default function DocumentsPage(props: Props) {
|
|||||||
ref={bulkExportDialogRef}
|
ref={bulkExportDialogRef}
|
||||||
onExport={handleBulkExport}
|
onExport={handleBulkExport}
|
||||||
isLoading={isBulkExporting}
|
isLoading={isBulkExporting}
|
||||||
// defaultEmail={defaultEmail}
|
defaultEmail={defaultEmail}
|
||||||
selectedCount={selection.length}
|
selectedCount={selection.length}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user