fix: [BLOCKER] status-change comments marked isSystemMessage to prevent auto-reopen

This commit is contained in:
Nemo
2026-03-24 16:41:43 +08:00
parent 77a395a2ef
commit 9ca012f75a

View File

@@ -96,6 +96,7 @@ export default function TicketDetailScreen() {
const who = user?.firstName ?? 'Staff'; const who = user?.firstName ?? 'Staff';
await api.post(`/api/v1/tickets/${id}/messages`, { await api.post(`/api/v1/tickets/${id}/messages`, {
body: `Status changed to ${status.replace('_', ' ')} by ${who}`, body: `Status changed to ${status.replace('_', ' ')} by ${who}`,
isSystemMessage: true,
}).catch(() => {}); }).catch(() => {});
return updatedTicket; return updatedTicket;
@@ -156,11 +157,15 @@ export default function TicketDetailScreen() {
const note = instNotes.trim() const note = instNotes.trim()
? `Installation confirmed. Location recorded: ${coordStr}. Notes: ${instNotes.trim()}` ? `Installation confirmed. Location recorded: ${coordStr}. Notes: ${instNotes.trim()}`
: `Installation confirmed. Location recorded: ${coordStr}`; : `Installation confirmed. Location recorded: ${coordStr}`;
await api.post(`/api/v1/tickets/${id}/messages`, { body: note }).catch(() => {}); await api.post(`/api/v1/tickets/${id}/messages`, { body: note, isSystemMessage: true }).catch(() => {});
// 4. Generate first invoice so it appears in Collect screen // 4. Generate first invoice so it appears in Collect screen
if (ticket?.clientId) { if (ticket?.clientId) {
await api.post(`/api/v1/invoices/generate/${ticket.clientId}`).catch(() => {}); try {
await api.post(`/api/v1/invoices/generate/${ticket.clientId}`);
} catch (e: any) {
console.warn('Invoice generation failed:', e?.response?.data?.message ?? e?.message);
}
} }
// 5. Create follow-up activation ticket (non-fatal) // 5. Create follow-up activation ticket (non-fatal)