fix(portal) : handle submittedBy as object or IRI in canEdit check

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 21:40:54 +01:00
parent cd8cea45c1
commit 7047f64a6b

View File

@@ -239,9 +239,12 @@ const canEdit = computed(() => {
if (status === 'done' || status === 'rejected') return false
const userId = auth.user?.id
if (!userId) return false
const submittedByIri = props.ticket.submittedBy
if (!submittedByIri) return false
return submittedByIri === `/api/users/${userId}`
const sub = props.ticket.submittedBy
if (!sub) return false
// submittedBy can be an IRI string or an embedded object
if (typeof sub === 'string') return sub === `/api/users/${userId}`
if (typeof sub === 'object' && 'id' in sub) return (sub as any).id === userId
return false
})
function startEdit() {