Skip to content

Commit 4c83a49

Browse files
committed
feat(entity-details): conditionally show report option for sources
- Add remote config check for source reporting enabled feature - Display report option in popup menu for sources only when the feature is enabled - Keep the report option hidden for topics and when the feature is disabled
1 parent 374f0d7 commit 4c83a49

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/entity_details/view/entity_details_page.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
107107
final theme = Theme.of(context);
108108
final textTheme = theme.textTheme;
109109
final colorScheme = theme.colorScheme;
110+
final remoteConfig = context.watch<AppBloc>().state.remoteConfig;
111+
final isSourceReportingEnabled =
112+
remoteConfig?.features.community.reporting.sourceReportingEnabled ??
113+
false;
110114

111115
return Scaffold(
112116
body: BlocBuilder<EntityDetailsBloc, EntityDetailsState>(
@@ -309,7 +313,8 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
309313
snap: false,
310314
actions: [
311315
followButton,
312-
if (widget.args.contentType != ContentType.topic)
316+
if (widget.args.contentType == ContentType.source &&
317+
isSourceReportingEnabled)
313318
PopupMenuButton<String>(
314319
onSelected: (value) {
315320
if (value == 'report') {
@@ -325,11 +330,11 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
325330
},
326331
itemBuilder: (BuildContext context) =>
327332
<PopupMenuEntry<String>>[
328-
PopupMenuItem<String>(
329-
value: 'report',
330-
child: Text(l10n.reportActionLabel),
331-
),
332-
],
333+
PopupMenuItem<String>(
334+
value: 'report',
335+
child: Text(l10n.reportActionLabel),
336+
),
337+
],
333338
)
334339
else
335340
const SizedBox.shrink(),

0 commit comments

Comments
 (0)