Merge remote-tracking branch 'origin/main' into push-channel-id-contract

* origin/main:
  fix(mobile): ignore unrelated mutes when building push subscriptions (#8608)

Signed-off-by: Tom Brow <tomb@block.xyz>
This commit is contained in:
Tom Brow
2026-10-26 12:19:07 -07:00
2 changed files with 22 additions and 4 deletions

View File

@@ -458,9 +458,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(
@@ -491,7 +494,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(

View File

@@ -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++)