fix: persist artefact review link by deriving URL from approval_token
All checks were successful
Deploy / deploy (push) Successful in 12s
All checks were successful
Deploy / deploy (push) Successful in 12s
Previously the review URL was only stored in component state and lost when the panel was reopened. Now derives it from the artefact's approval_token field, matching how PostDetailPanel works. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,7 +40,7 @@ export default function ArtefactDetailPanel({ artefact, onClose, onUpdate, onDel
|
||||
const [versionData, setVersionData] = useState(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
const [reviewUrl, setReviewUrl] = useState('')
|
||||
const [freshReviewUrl, setFreshReviewUrl] = useState('')
|
||||
const [copied, setCopied] = useState(false)
|
||||
const [activeTab, setActiveTab] = useState('details')
|
||||
|
||||
@@ -52,6 +52,7 @@ export default function ArtefactDetailPanel({ artefact, onClose, onUpdate, onDel
|
||||
const [editApproverIds, setEditApproverIds] = useState(
|
||||
artefact.approvers?.map(a => String(a.id)) || (artefact.approver_ids ? artefact.approver_ids.split(',').map(s => s.trim()).filter(Boolean) : [])
|
||||
)
|
||||
const reviewUrl = freshReviewUrl || (artefact.approval_token ? `${window.location.origin}/review/${artefact.approval_token}` : '')
|
||||
const [savingDraft, setSavingDraft] = useState(false)
|
||||
const [deleting, setDeleting] = useState(false)
|
||||
const [confirmDeleteLangId, setConfirmDeleteLangId] = useState(null)
|
||||
@@ -245,7 +246,7 @@ export default function ArtefactDetailPanel({ artefact, onClose, onUpdate, onDel
|
||||
setSubmitting(true)
|
||||
try {
|
||||
const res = await api.post(`/artefacts/${artefact.Id}/submit-review`)
|
||||
setReviewUrl(res.reviewUrl || res.data?.reviewUrl || '')
|
||||
setFreshReviewUrl(res.reviewUrl || res.data?.reviewUrl || '')
|
||||
toast.success(t('artefacts.submittedForReview'))
|
||||
onUpdate()
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user