Skip to content

Commit a34c393

Browse files
committed
fix(headline-details): filter similar headlines by topic and status
- Updated the filter criteria in SimilarHeadlinesBloc to include both topic ID and content status - Added ContentStatus import from core package - Modified the filter map to include 'status': ContentStatus.active.name - This change ensures that only active headlines from the same topic are fetched
1 parent 1e6857d commit a34c393

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/headline-details/bloc/similar_headlines_bloc.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'dart:async';
22

33
import 'package:bloc/bloc.dart';
44
import 'package:core/core.dart'
5-
show Headline, HttpException, PaginationOptions, SortOption, SortOrder;
5+
show ContentStatus, Headline, HttpException, PaginationOptions, SortOption, SortOrder;
66
import 'package:data_repository/data_repository.dart';
77
import 'package:equatable/equatable.dart';
88

@@ -28,7 +28,11 @@ class SimilarHeadlinesBloc
2828
try {
2929
final currentHeadline = event.currentHeadline;
3030

31-
final filter = <String, dynamic>{'topic.id': currentHeadline.topic.id};
31+
// Filter by topic ID and ensure only active headlines are fetched.
32+
final filter = <String, dynamic>{
33+
'topic.id': currentHeadline.topic.id,
34+
'status': ContentStatus.active.name,
35+
};
3236

3337
final response = await _headlinesRepository.readAll(
3438
filter: filter,

0 commit comments

Comments
 (0)