refactor: group icons are semantic keys, not emoji (display_title drops glyph)

Group icons move from OS-emoji (which render differently per platform) to
semantic keys rendered natively per client. The combined view's display_title
therefore no longer embeds an icon glyph — group-calendar events are
distinguished by their colour; only the owner/creator first-name is prefixed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-06-01 19:20:31 +02:00
parent 12c14e3c02
commit 4b7e5799bf

View File

@@ -316,16 +316,16 @@ def _first_name(name: Optional[str]) -> str:
def _decorate_title(title: str, *, is_group: bool, creator: Optional[dict], def _decorate_title(title: str, *, is_group: bool, creator: Optional[dict],
owner: Optional[dict], me_id: int, group_icon: Optional[str]) -> str: owner: Optional[dict], me_id: int) -> str:
"""Server-side display title for the combined view so every client (web, """Server-side display title for the combined view so every client (web,
iOS, Android) renders group events identically: the group's own icon for iOS, Android) renders identically: another member's / creator's first name
group-calendar events, the owner's first name for other members' events. is prefixed. No icon glyph is embedded — group icons are semantic keys the
The raw `title` is left untouched for editing.""" clients render as native vector icons, and group-calendar events are
icon = group_icon or "👥" distinguished by their (group) colour. The raw `title` stays for editing."""
if is_group: if is_group:
if creator and creator.get("id") is not None and creator.get("id") != me_id: if creator and creator.get("id") is not None and creator.get("id") != me_id:
return f"{icon} {_first_name(creator.get('display_name'))}: {title}" return f"{_first_name(creator.get('display_name'))}: {title}"
return f"{icon} {title}" return title
if owner and owner.get("id") is not None and owner.get("id") != me_id: if owner and owner.get("id") is not None and owner.get("id") != me_id:
return f"{_first_name(owner.get('display_name'))}: {title}" return f"{_first_name(owner.get('display_name'))}: {title}"
return title return title
@@ -413,7 +413,7 @@ def combined_events(
# so all clients render identically; raw `title` kept for editing. # so all clients render identically; raw `title` kept for editing.
b["display_title"] = _decorate_title( b["display_title"] = _decorate_title(
b.get("title", ""), is_group=is_group, creator=b.get("creator"), b.get("title", ""), is_group=is_group, creator=b.get("creator"),
owner=owner, me_id=current_user.id, group_icon=group.icon, owner=owner, me_id=current_user.id,
) )
all_events.append(b) all_events.append(b)