Use display name instead of username for shared calendar owners

Add db.DisplayName(username), returning the user's display name if
set, otherwise the raw username. Use it everywhere a shared calendar's
owner is shown: the web calendar legend ("shared by ..."), the "new
event"/edit calendar select label, the dashboard's "Shared with you"
list, and the CalDAV-side description/name-collision disambiguation
("Name (Owner)") shown to CalDAV clients like DAVx5.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-08-21 06:41:51 +02:00
co-authored by Copilot
parent 8b10386c91
commit d0e1dab837
4 changed files with 22 additions and 8 deletions
+13
View File
@@ -90,6 +90,19 @@ func (d *DB) SetProfile(username, displayName, email string) error {
return requireRowsAffected(res, ErrUserNotFound)
}
// DisplayName returns username's display name if one is set, otherwise
// username itself. This is the friendly label to show wherever a user's
// identity is surfaced in the UI (e.g. "shared by <name>"), instead of
// the raw login username.
func (d *DB) DisplayName(username string) string {
u, err := d.GetUser(username)
if err != nil || u.DisplayName == "" {
return username
}
return u.DisplayName
}
// DeleteUser removes username along with all of its calendars, address
// books, and sharing grants (calendars/addressbooks cascade via foreign