From 593adbbc0b3656255949ea1c36470589e32736d6 Mon Sep 17 00:00:00 2001 From: fahed Date: Thu, 5 Mar 2026 17:34:37 +0300 Subject: [PATCH] fix: review link always visible for posts with approval token Derived from post.approval_token instead of transient state, so it persists when the panel is closed and reopened. Co-Authored-By: Claude Opus 4.6 --- client/src/components/PostDetailPanel.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/src/components/PostDetailPanel.jsx b/client/src/components/PostDetailPanel.jsx index 3e4cbcc..661d138 100644 --- a/client/src/components/PostDetailPanel.jsx +++ b/client/src/components/PostDetailPanel.jsx @@ -23,7 +23,6 @@ export default function PostDetailPanel({ post, onClose, onSave, onDelete, brand // Review state const [submittingReview, setSubmittingReview] = useState(false) - const [reviewUrl, setReviewUrl] = useState('') const [copied, setCopied] = useState(false) // Attachments state @@ -36,6 +35,7 @@ export default function PostDetailPanel({ post, onClose, onSave, onDelete, brand const postId = post?._id || post?.id const isCreateMode = !postId + const reviewUrl = post?.approval_token ? `${window.location.origin}/review-post/${post.approval_token}` : '' useEffect(() => { if (post) { @@ -149,8 +149,7 @@ export default function PostDetailPanel({ post, onClose, onSave, onDelete, brand if (dirty) await handleSave() setSubmittingReview(true) try { - const res = await api.post(`/posts/${postId}/submit-review`) - setReviewUrl(res.reviewUrl || '') + await api.post(`/posts/${postId}/submit-review`) setForm(f => ({ ...f, status: 'in_review' })) toast.success(t('posts.submittedForReview')) onSave(postId, {}) // reload parent