Store source metadata for imported documents (#6136)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user