Fix ticket category saving and synchronization error handling
- Updated the ticket category saving logic to handle empty description and emoji fields, ensuring they are set to null if trimmed. - Enhanced error handling in the `maybeSyncTicketPanel` function to prevent UI errors when synchronization fails, allowing category CRUD operations to succeed. - Updated the response handling to include support role IDs in the UI after saving, improving data consistency. - Added validation for support role IDs in the dashboard schemas to ensure correct data types are used.
This commit is contained in:
@@ -105,7 +105,14 @@ async function maybeSyncTicketPanel(guildId: string): Promise<void> {
|
||||
if (!config?.enabled || !config.panelChannelId) {
|
||||
return;
|
||||
}
|
||||
await syncTicketPanel(guildId);
|
||||
// Category CRUD must succeed even if Discord panel sync fails — otherwise
|
||||
// support roles / category fields appear "unsaved" in the UI while already
|
||||
// persisted in Postgres.
|
||||
try {
|
||||
await syncTicketPanel(guildId);
|
||||
} catch (error) {
|
||||
console.warn('[tickets] panel sync after category change failed', { guildId, error });
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateTicketConfigDashboard(
|
||||
|
||||
Reference in New Issue
Block a user