v0.12.49 Login Type and Event bug fixes
This commit is contained in:
@@ -820,18 +820,28 @@ function EventDetailModal({ event, onClose, onEdit, onAvailabilityChange, isTool
|
||||
? [{ type:'self' }]
|
||||
: [{ type:'alias', aliasId:parseInt(responder.replace('alias:','')) }];
|
||||
|
||||
// For "All": toggle all off only when every target already has this response;
|
||||
// otherwise set all to this response (avoids partial-toggle confusion)
|
||||
const allHaveResp = responder === 'all' && targets.every(t =>
|
||||
t.type === 'self'
|
||||
? myResp === resp
|
||||
: (avail.find(r => r.is_alias && r.alias_id === t.aliasId)?.response || null) === resp
|
||||
);
|
||||
try {
|
||||
for (const t of targets) {
|
||||
const prevResp = t.type === 'self'
|
||||
? myResp
|
||||
: (avail.find(r => r.is_alias && r.alias_id === t.aliasId)?.response || null);
|
||||
if (prevResp === resp) {
|
||||
const shouldDelete = responder === 'all' ? allHaveResp : prevResp === resp;
|
||||
if (shouldDelete) {
|
||||
await api.deleteAvailability(event.id, t.type === 'alias' ? t.aliasId : undefined);
|
||||
} else {
|
||||
await api.setAvailability(event.id, resp, note, t.type === 'alias' ? t.aliasId : undefined);
|
||||
}
|
||||
}
|
||||
if (targets.some(t => t.type === 'self')) setMyResp(prev => prev === resp ? null : resp);
|
||||
if (targets.some(t => t.type === 'self')) {
|
||||
setMyResp(responder === 'all' ? (allHaveResp ? null : resp) : (myResp === resp ? null : resp));
|
||||
}
|
||||
onAvailabilityChange?.(resp);
|
||||
} catch(e) { toast(e.message,'error'); }
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user