Skip to content

Add Collections notification support - #2494

Open
joebarbere wants to merge 2 commits into
Dimillian:mainfrom
joebarbere:collections-phase2
Open

Add Collections notification support#2494
joebarbere wants to merge 2 commits into
Dimillian:mainfrom
joebarbere:collections-phase2

Conversation

@joebarbere

Copy link
Copy Markdown
Contributor

Phase 2 of #2478, following #2479 (read-only viewing).

Mastodon 4.6 added two notification types for Collections: added_to_collection (someone added you to their collection) and collection_update (a collection you're featured in changed). Both carry the Collection entity on the notification.

Until now Ice Cubes dropped these silently — an unrecognized type maps to a nil supportedType, and both consolidation paths skip those notifications entirely.

What's here

  • Two new NotificationType cases, and collection decoded on both Notification and NotificationGroup.
  • The collection is carried through v1 consolidation, the v2 grouped mapping, the streaming path, and the v2 group merge (newGroup.collection ?? existingGroup.collection, so a merge can't drop it).
  • NotificationRowCollectionView renders the same bordered pill used on profiles, tapping through to the existing CollectionDetailView. Icons are rectangle.stack.badge.person.crop.fill and person.2.crop.square.stack.fill, tinted indigo.
  • Push-notification taps route to the collection as well.
  • Both types appear in the notifications filter menu, gated on a new CurrentInstance.isCollectionsSupported.

Notes

NotificationGroup carries collection too. The docs page for that entity doesn't list it, but REST::NotificationGroupSerializer emits it for these types alongside REST::NotificationSerializer — I went with the source, so the grouped (v2) path works and not just v1.

isCollectionsSupported checks api_versions.mastodon >= 10 rather than parsing the version string. Collections shipped in 4.6.0, which bumped that to 10 (4.5.0 was 7, 4.7.1 is 11). The existing version helper does Float(String.prefix(3)), which would read a future "4.10" as 4.1 — this follows isQuoteSupported instead.

There are no WebPush alerts keys for collections, so the server never pushes these types; the NotificationTab branch exists for exhaustiveness and future-proofing.

Testing

Builds clean for the iOS simulator. ModelsTests passes 16/16, including four new decode tests: both notification types, a notification with no collection attached, and a NotificationGroup carrying one.

joebarbere and others added 2 commits September 4, 2026 21:06
Mastodon 4.6 added two notification types for Collections:
`added_to_collection` (someone added you to their collection) and
`collection_update` (a collection you're featured in changed). Both carry
the Collection entity on the notification, and both the v1 and the v2
grouped notification endpoints serialize it.

Until now Ice Cubes dropped these on the floor: an unknown `type` maps to
a nil `supportedType`, and both consolidation paths skip those. This adds
the two cases, decodes the attached `collection` on Notification and
NotificationGroup, carries it through consolidation, and renders it in
the notification row as the same collection pill used on profiles,
tappable through to the existing collection detail view. Push
notification taps route there too.

The two new types are also offered in the notifications filter menu, but
only on 4.6+ instances — older servers return nothing for them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ab8HLH6dDqz5QtrW2yWyeE
`CurrentInstance.version` parses `String.prefix(3)` into a Float, so a
future "4.10" reads as 4.1 and would silently switch Collections back
off. Collections shipped in 4.6.0, which bumped `api_versions.mastodon`
to 10 (4.5.0 was 7, 4.7.1 is 11), so gate on that instead — the same way
`isQuoteSupported` already does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ab8HLH6dDqz5QtrW2yWyeE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant