mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
read status
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
import prisma from "@documenso/prisma";
|
||||
import Head from "next/head";
|
||||
import { ReactElement } from "react";
|
||||
import Layout from "../../../components/layout";
|
||||
import Logo from "../../../components/logo";
|
||||
import { NextPageWithLayout } from "../../_app";
|
||||
import { Router } from "next/router";
|
||||
import { ReadStatus } from "@prisma/client";
|
||||
|
||||
const SignPage: NextPageWithLayout = () => {
|
||||
return (
|
||||
@ -19,4 +22,21 @@ SignPage.getLayout = function getLayout(page: ReactElement) {
|
||||
return <Layout>{page}</Layout>;
|
||||
};
|
||||
|
||||
export async function getServerSideProps(context: any) {
|
||||
const recipientToken: string = context.query["token"];
|
||||
|
||||
await prisma.recipient.updateMany({
|
||||
where: {
|
||||
token: recipientToken,
|
||||
},
|
||||
data: {
|
||||
readStatus: ReadStatus.OPENED,
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
props: {},
|
||||
};
|
||||
}
|
||||
|
||||
export default SignPage;
|
||||
|
||||
@ -6,6 +6,6 @@ export const sendSignedMail = async (document: any, recipient: any) => {
|
||||
await sendMail(
|
||||
document.user.email,
|
||||
`${recipient.email} signed ${document.title}`,
|
||||
`Hi ${document.user.name}, ${recipient.email} has signed your document ${document.title}. Click <a href="${NEXT_PUBLIC_WEBAPP_URL}/document/${document.id}"> VIEW DOCUMENT</a> to view it now.`
|
||||
`Hi ${document.user.name}, ${recipient.email} has signed your document ${document.title}. Click <a href="${NEXT_PUBLIC_WEBAPP_URL}/document/${document.id}?token=${recipient.token}"> VIEW DOCUMENT</a> to view it now.`
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user