Show plain calendar name for shared calendars, drop ~owner prefix

DAVx5/CalDAV clients displayed a shared calendar's DAV:displayname as
"alice~work" (the synthetic owner~name local identifier nidus uses
internally to keep a shared calendar's URL unique per subscriber).
That internal name is still needed for routing (it's still what appears
in the calendar's URL path), but there's no reason to show it to the
end user as the calendar's label.

calendarMeta() now always sets caldav.Calendar.Name to the plain
calendar name (e.g. "work"), while Path still uses the "owner~name"
local name. The web UI already showed the plain name via a separate
"shared by <owner>" entry, so it's unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-08-20 10:09:41 +02:00
co-authored by Copilot
parent 5f72e58ad3
commit 65cd24a192
2 changed files with 9 additions and 5 deletions
+6 -2
View File
@@ -310,8 +310,12 @@ func (b *Backend) resolveCalendar(requester, localName string, requireWrite bool
func (b *Backend) calendarMeta(owner, realName, localName string) caldav.Calendar { func (b *Backend) calendarMeta(owner, realName, localName string) caldav.Calendar {
desc := fmt.Sprintf("%s's %s calendar", owner, realName) desc := fmt.Sprintf("%s's %s calendar", owner, realName)
return caldav.Calendar{ return caldav.Calendar{
Path: calHomePath() + localName + "/", Path: calHomePath() + localName + "/",
Name: localName, // The displayed name is always the plain calendar name (never the
// "owner~name" synthetic local name used internally to keep a
// shared calendar's URL unique) — clients like DAVx5 show this as
// the calendar's label, and "alice~work" looked confusing there.
Name: realName,
Description: desc, Description: desc,
SupportedComponentSet: []string{"VEVENT", "VTODO", "VJOURNAL"}, SupportedComponentSet: []string{"VEVENT", "VTODO", "VJOURNAL"},
MaxResourceSize: 10 * 1024 * 1024, // 10 MiB MaxResourceSize: 10 * 1024 * 1024, // 10 MiB
+3 -3
View File
@@ -90,14 +90,14 @@ func TestListCalendarsIncludesSharedCalendar(t *testing.T) {
} }
var found bool var found bool
wantName := sharedCalendarName("alice", "work") wantPath := calHomePath() + sharedCalendarName("alice", "work") + "/"
for _, c := range cals { for _, c := range cals {
if c.Name == wantName { if c.Path == wantPath && c.Name == "work" {
found = true found = true
} }
} }
if !found { if !found {
t.Errorf("shared calendar %q not found in ListCalendars result: %+v", wantName, cals) t.Errorf("shared calendar with path %q and display name %q not found in ListCalendars result: %+v", wantPath, "work", cals)
} }
} }