mirror of
https://github.com/block/buzz.git
synced 2026-11-02 15:31:27 +00:00
Reverts [#8615](https://github.com/block/buzz/pull/8615).
Mobile push for Solo chats returns to mention-only, matching buzz-app,
which alerts on every message only in DMs. This also removes the
lease-size guards #8615 added, since they existed to fit Solo chats into
the lease.
### Validation
- Clean revert of bad9d26142 with no conflicts.
- Mobile lint and the full mobile test suite pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Tom Brow <tomb@squareup.com>
67 lines
2.1 KiB
Dart
67 lines
2.1 KiB
Dart
import 'package:buzz/features/channels/channel.dart';
|
|
import 'package:buzz/shared/community/community.dart';
|
|
import 'package:buzz/shared/push/push_subscription.dart';
|
|
import 'package:buzz/shared/push/push_subscription_provider.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:nostr/nostr.dart' as nostr;
|
|
|
|
void main() {
|
|
const activeID = '123e4567-e89b-42d3-a456-426614174000';
|
|
const archivedID = '123e4567-e89b-42d3-a456-426614174001';
|
|
const nonMemberID = '123e4567-e89b-42d3-a456-426614174002';
|
|
|
|
test(
|
|
'derives desired subscriptions from nsec, membership, and mute state',
|
|
() {
|
|
final nsec = nostr.Keys.generate().nsec;
|
|
final subscriptions = desiredBuzzPushSubscriptions(
|
|
community: Community.create(
|
|
name: 'Team',
|
|
relayUrl: 'https://relay.example.com',
|
|
nsec: nsec,
|
|
),
|
|
channels: [
|
|
channel(activeID),
|
|
channel(archivedID, archived: true),
|
|
channel(nonMemberID, isMember: false),
|
|
],
|
|
mutedChannelIds: const [activeID, archivedID],
|
|
);
|
|
|
|
expect(subscriptions, isNotNull);
|
|
expect(subscriptions, hasLength(1));
|
|
expect(subscriptions!.single.filter.pTags, hasLength(1));
|
|
expect(subscriptions.single.ignore, hasLength(2));
|
|
expect(subscriptions.single.ignore.first.kinds, buzzPushRenderableKinds);
|
|
expect(subscriptions.single.ignore.last.hTags, [activeID]);
|
|
},
|
|
);
|
|
|
|
test('returns no desired subscriptions without a signing identity', () {
|
|
final subscriptions = desiredBuzzPushSubscriptions(
|
|
community: Community.create(
|
|
name: 'Team',
|
|
relayUrl: 'https://relay.example.com',
|
|
),
|
|
channels: [channel(activeID)],
|
|
mutedChannelIds: const [],
|
|
);
|
|
|
|
expect(subscriptions, isNull);
|
|
});
|
|
}
|
|
|
|
Channel channel(String id, {bool isMember = true, bool archived = false}) =>
|
|
Channel(
|
|
id: id,
|
|
name: id,
|
|
channelType: 'dm',
|
|
visibility: 'open',
|
|
description: '',
|
|
createdBy: 'author',
|
|
createdAt: DateTime(2026),
|
|
memberCount: 1,
|
|
isMember: isMember,
|
|
archivedAt: archived ? DateTime(2026) : null,
|
|
);
|