mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
read status
This commit is contained in:
@ -1,8 +1,11 @@
|
|||||||
|
import prisma from "@documenso/prisma";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import { ReactElement } from "react";
|
import { ReactElement } from "react";
|
||||||
import Layout from "../../../components/layout";
|
import Layout from "../../../components/layout";
|
||||||
import Logo from "../../../components/logo";
|
import Logo from "../../../components/logo";
|
||||||
import { NextPageWithLayout } from "../../_app";
|
import { NextPageWithLayout } from "../../_app";
|
||||||
|
import { Router } from "next/router";
|
||||||
|
import { ReadStatus } from "@prisma/client";
|
||||||
|
|
||||||
const SignPage: NextPageWithLayout = () => {
|
const SignPage: NextPageWithLayout = () => {
|
||||||
return (
|
return (
|
||||||
@ -19,4 +22,21 @@ SignPage.getLayout = function getLayout(page: ReactElement) {
|
|||||||
return <Layout>{page}</Layout>;
|
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;
|
export default SignPage;
|
||||||
|
|||||||
@ -6,6 +6,6 @@ export const sendSignedMail = async (document: any, recipient: any) => {
|
|||||||
await sendMail(
|
await sendMail(
|
||||||
document.user.email,
|
document.user.email,
|
||||||
`${recipient.email} signed ${document.title}`,
|
`${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