mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
fix(mobile): ignore unrelated mutes when building push subscriptions (#8608)
## Summary Muting a starter channel (#welcome-everyone or #general) could leave the iOS app on a blank screen after launch. Starter channels use UUIDv5 IDs. Push subscription setup checked every synced mute against the lease's UUIDv4 channel grammar and threw `FormatException: Push subscription channel ID is invalid.` from `pushSubscriptionSyncProvider` during build, so the first frame never rendered. Whether you saw a blank screen depended on whether channels and mutes finished loading before the first frame. Mutes only feed the lease as ignore filters for subscribed (DM) channels, and mutes sync across every community and channel type. So the builder now matches mutes against the subscribed channels before using them, instead of validating every mute. Subscribed channel IDs are still validated as before. ### Related issue None found. ### Testing - Captured the failure on a dogfood iPhone build from the device system log, with a stack trace through `buildDesiredBuzzPushSubscriptions` and the muted ID `fee88e92-da9f-5958-a910-48db3264ad38` (#welcome-everyone). Unmuting that channel from desktop fixed the device immediately, which confirms the cause. - New regression test `ignores mutes outside the push channel grammar` fails on `main` with the same exception and passes with this change. - The pre-push `mobile-checks` hook (`just mobile-check && just mobile-test`) passed on this head. - Screenshots: not applicable. This changes no UI. It only stops a startup failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com> Co-authored-by: Carl <c217fe6b9d958f41c3a5e030dccc7f626775a923089cb6491305eade75ea1f1b@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -456,9 +456,12 @@ List<BuzzPushSubscription> buildDesiredBuzzPushSubscriptions({
|
||||
}
|
||||
|
||||
final normalizedChannelIds = channelIds.map(_normalizeChannelID).toSet();
|
||||
final normalizedMuted = mutedChannelIds.map(_normalizeChannelID).toSet();
|
||||
final activeMuted =
|
||||
normalizedMuted.intersection(normalizedChannelIds).toList()..sort();
|
||||
// Mutes sync across every community and channel type, so only mutes of
|
||||
// subscribed channels matter here; others need not fit the push grammar.
|
||||
final activeMuted = {
|
||||
for (final id in mutedChannelIds)
|
||||
if (normalizedChannelIds.contains(id.toLowerCase())) id.toLowerCase(),
|
||||
}.toList()..sort();
|
||||
final mutedIgnoreFilters = <BuzzPushFilter>[];
|
||||
for (final chunk in _chunks(activeMuted, buzzPushChannelChunkSize)) {
|
||||
mutedIgnoreFilters.add(
|
||||
@@ -489,7 +492,7 @@ List<BuzzPushSubscription> buildDesiredBuzzPushSubscriptions({
|
||||
),
|
||||
];
|
||||
|
||||
final channels = normalizedChannelIds.difference(normalizedMuted).toList()
|
||||
final channels = normalizedChannelIds.difference(activeMuted.toSet()).toList()
|
||||
..sort();
|
||||
for (final chunk in _chunks(channels, buzzPushChannelChunkSize)) {
|
||||
subscriptions.add(
|
||||
|
||||
@@ -93,6 +93,21 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('ignores mutes outside the push channel grammar', () {
|
||||
// Starter channels use UUIDv5 IDs; muting one must not break push setup.
|
||||
const starterChannel = 'fee88e92-da9f-5958-a910-48db3264ad38';
|
||||
|
||||
final subscriptions = buildDesiredBuzzPushSubscriptions(
|
||||
myPubkey: me,
|
||||
channelIds: [channelA],
|
||||
mutedChannelIds: [starterChannel, 'not-a-channel'],
|
||||
);
|
||||
|
||||
expect(subscriptions, hasLength(2));
|
||||
expect(subscriptions.first.ignore, hasLength(1));
|
||||
expect(subscriptions.last.filter.hTags, [channelA]);
|
||||
});
|
||||
|
||||
test('chunks channel subscriptions to relay limits deterministically', () {
|
||||
final channels = [
|
||||
for (var i = 0; i < 51; i++)
|
||||
|
||||
Reference in New Issue
Block a user