mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 07:51:12 -05:00
Fix ticket merging implementation
This commit is contained in:
@@ -507,7 +507,26 @@ export default function AdminContact() {
|
||||
const handleConfirmMerge = () => {
|
||||
if (!primaryTicketId || selectedForMerge.length < 2) return;
|
||||
|
||||
// Ensure primary is actually in the selected list
|
||||
if (!selectedForMerge.includes(primaryTicketId)) {
|
||||
handleError(
|
||||
new Error('Primary ticket must be one of the selected tickets'),
|
||||
{ action: 'Merge Tickets' }
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const mergeIds = selectedForMerge.filter(id => id !== primaryTicketId);
|
||||
|
||||
// Additional validation: ensure we have tickets to merge
|
||||
if (mergeIds.length === 0) {
|
||||
handleError(
|
||||
new Error('No tickets to merge. Please select at least 2 tickets.'),
|
||||
{ action: 'Merge Tickets' }
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
mergeTicketsMutation.mutate({
|
||||
primaryId: primaryTicketId,
|
||||
mergeIds,
|
||||
|
||||
Reference in New Issue
Block a user