feat(web): mark read-only shared calendars and hide them from the event editor
- Sidebar: a calendar shared with read access shows "· Nur lesen" next to the "shared with me · <owner>" label. - Event editor calendar picker: exclude read-only shared calendars (own + read_write, incl. group calendars, stay) so a save can't 403. Parity with the server/iOS/Android sharing changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -728,9 +728,10 @@ function renderCalendarList() {
|
|||||||
remove: { icon: TRASH, title: t('remove_cal') } });
|
remove: { icon: TRASH, title: t('remove_cal') } });
|
||||||
});
|
});
|
||||||
state.localCalendars.filter(c => c.owned === false && !c.group).forEach(cal => {
|
state.localCalendars.filter(c => c.owned === false && !c.group).forEach(cal => {
|
||||||
|
const readOnly = cal.permission !== 'read_write';
|
||||||
entries.push({ key: `local:${cal.id}`, source: 'local', dataId: `data-cal-id="${cal.id}"`,
|
entries.push({ key: `local:${cal.id}`, source: 'local', dataId: `data-cal-id="${cal.id}"`,
|
||||||
name: cal.name, color: cal.color, enabled: cal.enabled,
|
name: cal.name, color: cal.color, enabled: cal.enabled,
|
||||||
sourceLabel: `${t('shared_with_me')} · ${cal.shared_by || ''}`, remove: null });
|
sourceLabel: `${t('shared_with_me')} · ${cal.shared_by || ''}${readOnly ? ' · ' + t('perm_read') : ''}`, remove: null });
|
||||||
});
|
});
|
||||||
// Group calendars (owned by the creator or reached via membership) — shown so
|
// Group calendars (owned by the creator or reached via membership) — shown so
|
||||||
// they can be toggled/recoloured. Owned group calendars can also be muted
|
// they can be toggled/recoloured. Owned group calendars can also be muted
|
||||||
@@ -1577,8 +1578,10 @@ function populateCalendarSelect(selectedId) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
// Local calendars. Group calendars are collected under a "Groups" optgroup
|
// Local calendars. Group calendars are collected under a "Groups" optgroup
|
||||||
// (no emoji — a native <select> can't render the group icon SVG).
|
// (no emoji — a native <select> can't render the group icon SVG). Read-only
|
||||||
const localCals = state.localCalendars.filter(c => !c.sidebar_hidden);
|
// shared calendars are excluded — a save would only 403.
|
||||||
|
const localCals = state.localCalendars.filter(c =>
|
||||||
|
!c.sidebar_hidden && (c.owned !== false || c.permission === 'read_write'));
|
||||||
const makeLocalOpt = cal => {
|
const makeLocalOpt = cal => {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = `local-${cal.id}`;
|
opt.value = `local-${cal.id}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user