Store source metadata for imported documents (#6136)

This commit is contained in:
Tom Moor
2023-11-11 10:52:29 -05:00
committed by GitHub
parent 90605e110a
commit 48d688c0a5
16 changed files with 178 additions and 48 deletions

View File

@@ -7,6 +7,7 @@ import {
InvalidRequestError,
AuthorizationError,
AuthenticationError,
PaymentRequiredError,
} from "@server/errors";
import { Collection, Document, Share, User, Team } from "@server/models";
import { authorize, can } from "@server/policies";
@@ -119,6 +120,10 @@ export default async function loadDocument({
throw NotFoundError("Document could not be found for shareId");
}
if (document.isTrialImport) {
throw PaymentRequiredError();
}
// If the user has access to read the document, we can just update
// the last access date and return the document without additional checks.
const canReadDocument = user && can(user, "read", document);
@@ -202,6 +207,10 @@ export default async function loadDocument({
user && authorize(user, "read", document);
}
if (document.isTrialImport) {
throw PaymentRequiredError();
}
collection = document.collection;
}