diff --git a/mobile/lib/shared/push/push_subscription.dart b/mobile/lib/shared/push/push_subscription.dart index 761984b20b..788a1d3ab2 100644 --- a/mobile/lib/shared/push/push_subscription.dart +++ b/mobile/lib/shared/push/push_subscription.dart @@ -458,9 +458,12 @@ List 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 = []; for (final chunk in _chunks(activeMuted, buzzPushChannelChunkSize)) { mutedIgnoreFilters.add( @@ -491,7 +494,7 @@ List buildDesiredBuzzPushSubscriptions({ ), ]; - final channels = normalizedChannelIds.difference(normalizedMuted).toList() + final channels = normalizedChannelIds.difference(activeMuted.toSet()).toList() ..sort(); for (final chunk in _chunks(channels, buzzPushChannelChunkSize)) { subscriptions.add( diff --git a/mobile/test/shared/push/push_subscription_test.dart b/mobile/test/shared/push/push_subscription_test.dart index bd2bf53d93..079f2739e0 100644 --- a/mobile/test/shared/push/push_subscription_test.dart +++ b/mobile/test/shared/push/push_subscription_test.dart @@ -143,6 +143,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++)