Fix /new/from posts

This commit is contained in:
Max Leiter 2022-12-17 16:28:49 -08:00
parent ff310a67b9
commit 34a92a265f
3 changed files with 8 additions and 7 deletions

View file

@ -22,15 +22,18 @@ const NewFromExisting = async ({
} }
const post = await getPostById(id, { const post = await getPostById(id, {
include: {
files: true,
author: false
},
select: { select: {
authorId: true, authorId: true,
title: true, title: true,
description: true, description: true,
id: true, id: true,
files: {
select: {
title: true,
content: true,
id: true,
}
}
} }
}) })

View file

@ -18,7 +18,6 @@ const PostFiles = ({
post: _initialPost, post: _initialPost,
isAuthor: isAuthorFromServer isAuthor: isAuthorFromServer
}: Props) => { }: Props) => {
console.log("PostFiles")
const { data: session, status } = useSession() const { data: session, status } = useSession()
const isLoading = status === "loading" const isLoading = status === "loading"
const initialPost = const initialPost =
@ -27,7 +26,6 @@ const PostFiles = ({
: _initialPost : _initialPost
const [post, setPost] = useState<PostWithFilesAndAuthor>(initialPost) const [post, setPost] = useState<PostWithFilesAndAuthor>(initialPost)
const isProtected = initialPost.visibility === "protected" const isProtected = initialPost.visibility === "protected"
console.log(_initialPost, post)
// We generate public and unlisted posts at build time, so we can't use // We generate public and unlisted posts at build time, so we can't use
// the session to determine if the user is the author on the server. We need to check // the session to determine if the user is the author on the server. We need to check

View file

@ -60,7 +60,7 @@ const Profile = ({ user }: { user: User }) => {
return ( return (
<> <>
<Note type="warning"> <Note type="warning">
This information will be publicly available on your profile This information will be publicly available on your profile.
</Note> </Note>
<form onSubmit={onSubmit} className={styles.form}> <form onSubmit={onSubmit} className={styles.form}>
<div> <div>