Skip to content

Commit

Permalink
fix: RequestFilter for EventCountResultEntity (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-endymion authored Jan 23, 2025
1 parent 8dc2d80 commit 3fc3ddb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/app/features/user/providers/followers_count_provider.c.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'package:ion/app/exceptions/exceptions.dart';
import 'package:ion/app/extensions/extensions.dart';
import 'package:ion/app/features/auth/providers/auth_provider.c.dart';
import 'package:ion/app/features/feed/data/models/entities/event_count_request_data.c.dart';
import 'package:ion/app/features/feed/data/models/entities/event_count_result_data.c.dart';
import 'package:ion/app/features/ion_connect/model/action_source.dart';
Expand Down Expand Up @@ -38,15 +39,20 @@ class FollowersCount extends _$FollowersCount {
}

Future<int> _fetchFollowersCount(String pubkey) async {
final relay = await _getRandomUserRelay();
final currentPubkey = ref.read(currentPubkeySelectorProvider).valueOrNull;
if (currentPubkey == null) {
throw UserMasterPubkeyNotFoundException();
}

final relay = await _getRandomUserRelay();
final requestEvent = await _buildRequestEvent(relayUrl: relay.url);

final subscriptionMessage = RequestMessage()
..addFilter(
RequestFilter(
kinds: const [EventCountResultEntity.kind, 7400],
tags: {
'#p': [pubkey],
'#p': [currentPubkey],
},
),
);
Expand Down Expand Up @@ -91,7 +97,9 @@ class FollowersCount extends _$FollowersCount {
filters: [
RequestFilter(
kinds: const [FollowListEntity.kind],
authors: [pubkey],
tags: {
'#p': [pubkey],
},
),
],
);
Expand Down

0 comments on commit 3fc3ddb

Please sign in to comment.