fix: disable chat for closed reports
This commit is contained in:
@@ -69,6 +69,12 @@ const handleSubmitFeedback = async () => {
|
||||
const isOwner = computed(() => report.value?.user_id === user.value?.id)
|
||||
const canFeedback = computed(() => report.value?.status === 'RESOLVED')
|
||||
|
||||
const canChat = computed(() => {
|
||||
if (!report.value) return false
|
||||
const closedStatuses = ['RESOLVED', 'CLOSED', 'REJECTED']
|
||||
return !closedStatuses.includes(report.value.status)
|
||||
})
|
||||
|
||||
const statusMeta: Record<string, { label: string; tone: string }> = {
|
||||
OPEN: { label: 'Aperta', tone: 'info' },
|
||||
UNDER_REVIEW: { label: 'In revisione', tone: 'warning' },
|
||||
@@ -210,7 +216,12 @@ const formatDate = (dateString: string): string => {
|
||||
|
||||
<MessageList :messages="messages"/>
|
||||
|
||||
<MessageComposer @send="handleSendMessage"/>
|
||||
<MessageComposer v-if="canChat" @send="handleSendMessage"/>
|
||||
<div v-else class="alert alert-secondary mt-3 mb-0 text-center small">
|
||||
La chat è disabilitata poiché la segnalazione è in stato
|
||||
<strong>{{ statusMeta[report.status]?.label || report.status }}</strong>.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user