fix(post): mod and author edits weren't instant

This commit is contained in:
Tom (plebeius.eth)
2024-06-21 22:02:56 +02:00
parent 533fc2ffa3
commit cb745ffce6
5 changed files with 43 additions and 41 deletions
+10 -8
View File
@@ -28,13 +28,21 @@ export const Post = ({ post, showAllReplies = false, showReplies = true, openRep
const subplebbit = useSubplebbit({ subplebbitAddress: post?.subplebbitAddress });
const isMobile = useIsMobile();
let comment = post;
// handle pending mod or author edit
const { editedComment } = useEditedComment({ comment });
if (editedComment) {
comment = editedComment;
}
return (
<div className={styles.thread}>
<div className={styles.postContainer}>
{isMobile ? (
<PostMobile post={post} roles={subplebbit?.roles} showAllReplies={showAllReplies} showReplies={showReplies} openReplyModal={openReplyModal} />
<PostMobile post={comment} roles={subplebbit?.roles} showAllReplies={showAllReplies} showReplies={showReplies} openReplyModal={openReplyModal} />
) : (
<PostDesktop post={post} roles={subplebbit?.roles} showAllReplies={showAllReplies} showReplies={showReplies} openReplyModal={openReplyModal} />
<PostDesktop post={comment} roles={subplebbit?.roles} showAllReplies={showAllReplies} showReplies={showReplies} openReplyModal={openReplyModal} />
)}
</div>
</div>
@@ -66,12 +74,6 @@ const PostPage = () => {
post = comment;
}
// handle pending mod or author edit
const { editedComment } = useEditedComment({ comment: post });
if (editedComment) {
post = editedComment;
}
const { deleted, locked, removed } = post || {};
const isThreadClosed = deleted || locked || removed;