feat: Show 'Edit' button when visiting share link as signed in user with permission (#1980)

This commit is contained in:
Tom Moor
2021-03-23 19:22:15 -07:00
committed by GitHub
parent 97158b1337
commit 877c01f723
6 changed files with 79 additions and 61 deletions

View File

@ -483,7 +483,14 @@ async function loadDocument({ id, shareId, user }) {
throw new InvalidRequestError("Document could not be found for shareId");
}
document = share.document;
if (user) {
document = await Document.findByPk(share.documentId, {
userId: user.id,
paranoid: false,
});
} else {
document = share.document;
}
if (!share.published) {
authorize(user, "read", document);