From da74e8dc786d285ded597d8080bcfe8a0c5efd29 Mon Sep 17 00:00:00 2001 From: Guido Schmit Date: Tue, 5 May 2026 17:54:15 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Quell-Kalender=20wird=20beim=20Kopieren?= =?UTF-8?q?=20ausgeblendet=20buildWritableCalendars=20excluded=20jetzt=20d?= =?UTF-8?q?en=20Kalender,=20in=20dem=20das=20Event=20bereits=20ist=20?= =?UTF-8?q?=E2=80=93=20so=20kann=20man=20nicht=20mehr=20in=20denselben=20K?= =?UTF-8?q?alender=20kopieren.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/js/calendar.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/frontend/js/calendar.js b/frontend/js/calendar.js index fca22db..4f27111 100644 --- a/frontend/js/calendar.js +++ b/frontend/js/calendar.js @@ -2502,28 +2502,45 @@ function escHtml(s) { return String(s).replace(/&/g,'&').replace(//g,'>'); } -function buildWritableCalendars(_excludeEv) { +function buildWritableCalendars(excludeEv) { + // Determine the event's current calendar to exclude it from copy targets + let excludeType = null; + let excludeId = null; + if (excludeEv) { + const cid = String(excludeEv.calendar_id); + if (excludeEv.source === 'local') { + excludeType = 'local'; excludeId = parseInt(cid.replace('local-', '')); + } else if (excludeEv.source === 'google') { + excludeType = 'google'; excludeId = parseInt(cid.replace('google-', '')); + } else if (excludeEv.source === 'homeassistant') { + excludeType = 'homeassistant'; excludeId = parseInt(cid.replace('homeassistant-', '')); + } else if (excludeEv.source === 'caldav' || !excludeEv.source) { + excludeType = 'caldav'; excludeId = parseInt(cid); + } + } + const skip = (type, id) => excludeType === type && excludeId === id; + const list = []; let idx = 0; for (const acc of state.accounts) { for (const cal of acc.calendars) { - if (cal.sidebar_hidden) continue; + if (cal.sidebar_hidden || skip('caldav', cal.id)) continue; list.push({ _idx: idx++, id: cal.id, name: `${acc.name} / ${cal.name}`, color: cal.color || '#4285f4', type: 'caldav' }); } } for (const cal of state.localCalendars) { - if (cal.sidebar_hidden) continue; + if (cal.sidebar_hidden || skip('local', cal.id)) continue; list.push({ _idx: idx++, id: cal.id, name: cal.name, color: cal.color || '#34a853', type: 'local' }); } for (const acc of state.googleAccounts) { for (const cal of acc.calendars) { - if (cal.sidebar_hidden) continue; + if (cal.sidebar_hidden || skip('google', cal.id)) continue; list.push({ _idx: idx++, id: cal.id, name: `${acc.email} / ${cal.name}`, color: cal.color || '#4285f4', type: 'google' }); } } for (const acc of state.haAccounts) { for (const cal of acc.calendars) { - if (cal.sidebar_hidden) continue; + if (cal.sidebar_hidden || skip('homeassistant', cal.id)) continue; list.push({ _idx: idx++, id: cal.id, name: `${acc.name} / ${cal.name}`, color: cal.color || '#03a9f4', type: 'homeassistant' }); } }