feat(social): local blocklist — hide blocked authors' offers, chats and incoming messages, with unblock management

This commit is contained in:
vjrj 2026-07-13 01:03:10 +02:00
parent 5d25f65f76
commit 11b242edbf
13 changed files with 399 additions and 4 deletions

View file

@ -71,4 +71,25 @@ void main() {
await store.write('tane.social.search_precision', 'oops');
expect(await SocialSettings(store).searchPrecision(), 4);
});
test('the blocklist starts empty and round-trips block/unblock', () async {
expect(await settings.blockedPubkeys(), isEmpty);
await settings.block('AB' * 32);
expect(await settings.isBlocked('ab' * 32), isTrue); // normalised
expect(await settings.blockedPubkeys(), {'ab' * 32});
await settings.block('cd' * 32);
expect(await settings.blockedPubkeys(), hasLength(2));
await settings.unblock('ab' * 32);
expect(await settings.isBlocked('ab' * 32), isFalse);
expect(await settings.blockedPubkeys(), {'cd' * 32});
});
test('blocking twice keeps a single entry', () async {
await settings.block('ab' * 32);
await settings.block(' AB' * 1 + 'ab' * 31); // messy spacing/case
expect(await settings.blockedPubkeys(), hasLength(1));
});
}