Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions lib/community_management/bloc/community_management_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,27 @@ class CommunityManagementBloc
}

Map<String, dynamic> buildEngagementsFilterMap(EngagementsFilter filter) {
final filterMap = <String, dynamic>{};
final conditions = <Map<String, dynamic>>[];

if (filter.searchQuery != null && filter.searchQuery!.isNotEmpty) {
filterMap['userId'] = filter.searchQuery;
conditions.add({'userId': filter.searchQuery});
}

if (filter.selectedStatus != null) {
filterMap['comment.status'] = {
r'$in': [filter.selectedStatus!.name],
};
if (filter.selectedStatus == ModerationStatus.resolved) {
conditions.add({'comment.status': ModerationStatus.resolved.name});
} else {
conditions.add({'comment.status': filter.selectedStatus!.name});
}
}

if (conditions.isEmpty) {
return {};
} else if (conditions.length == 1) {
return conditions.first;
} else {
return {r'$and': conditions};
}
return filterMap;
}

Map<String, dynamic> buildReportsFilterMap(ReportsFilter filter) {
Expand Down
14 changes: 7 additions & 7 deletions lib/community_management/view/engagements_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ class _EngagementsDataSource extends DataTableSource {
side: BorderSide.none,
visualDensity: VisualDensity.compact,
)
: Text(
l10n.notAvailable,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(
context,
).colorScheme.onSurface.withOpacity(0.6),
),
: Chip(
label: Text(l10n.notAvailable),
backgroundColor: Theme.of(
context,
).colorScheme.onSurface.withOpacity(0.1),
side: BorderSide.none,
visualDensity: VisualDensity.compact,
),
),
DataCell(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,19 @@ class _CommunityFilterDialogState extends State<CommunityFilterDialog> {
case CommunityManagementTab.engagements:
return [
_buildCapsuleFilter<ModerationStatus>(
title: l10n.status,
title: l10n.commentStatus,
allValues: ModerationStatus.values,
selectedValue: state.engagementsFilter.selectedStatus,
labelBuilder: (item) => item.l10n(context),
onChanged: (item) {
context.read<CommunityFilterBloc>().add(
EngagementsFilterChanged(
EngagementsFilter(
searchQuery: state.engagementsFilter.searchQuery,
selectedStatus: item,
),
),
);
EngagementsFilterChanged(
EngagementsFilter(
searchQuery: state.engagementsFilter.searchQuery,
selectedStatus: item,
),
),
);
},
),
];
Expand Down
14 changes: 13 additions & 1 deletion lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3440,12 +3440,24 @@ abstract class AppLocalizations {
/// **'Comment'**
String get comment;

/// Column header for comment status
/// Label for the moderation status of a comment within an engagement.
///
/// In en, this message translates to:
/// **'Comment Status'**
String get commentStatus;

/// Label for the switch to filter engagements based on whether they have a comment.
///
/// In en, this message translates to:
/// **'Contains Comment'**
String get hasCommentFilterLabel;

/// Description for the switch to filter engagements based on whether they have a comment.
///
/// In en, this message translates to:
/// **'Show only engagements that include a text comment.'**
String get hasCommentFilterDescription;

/// Column header for date
///
/// In en, this message translates to:
Expand Down
7 changes: 7 additions & 0 deletions lib/l10n/app_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,13 @@ class AppLocalizationsAr extends AppLocalizations {
@override
String get commentStatus => 'حالة التعليق';

@override
String get hasCommentFilterLabel => 'تحتوي على تعليقات';

@override
String get hasCommentFilterDescription =>
'إظهار التفاعلات التي تتضمن تعليقًا نصيًا فقط.';

@override
String get date => 'التاريخ';

Expand Down
7 changes: 7 additions & 0 deletions lib/l10n/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,13 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get commentStatus => 'Comment Status';

@override
String get hasCommentFilterLabel => 'Contains Comment';

@override
String get hasCommentFilterDescription =>
'Show only engagements that include a text comment.';

@override
String get date => 'Date';

Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/arb/app_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2316,7 +2316,15 @@
},
"commentStatus": "حالة التعليق",
"@commentStatus": {
"description": "رأس العمود لحالة التعليق"
"description": "تسمية لحالة الإشراف على تعليق ضمن تفاعل."
},
"hasCommentFilterLabel": "تحتوي على تعليقات",
"@hasCommentFilterLabel": {
"description": "تسمية لمفتاح تصفية التفاعلات بناءً على وجود تعليق."
},
"hasCommentFilterDescription": "إظهار التفاعلات التي تتضمن تعليقًا نصيًا فقط.",
"@hasCommentFilterDescription": {
"description": "وصف لمفتاح تصفية التفاعلات بناءً على وجود تعليق."
},
"date": "التاريخ",
"@date": {
Expand Down
10 changes: 9 additions & 1 deletion lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2312,7 +2312,15 @@
},
"commentStatus": "Comment Status",
"@commentStatus": {
"description": "Column header for comment status"
"description": "Label for the moderation status of a comment within an engagement."
},
"hasCommentFilterLabel": "Contains Comment",
"@hasCommentFilterLabel": {
"description": "Label for the switch to filter engagements based on whether they have a comment."
},
"hasCommentFilterDescription": "Show only engagements that include a text comment.",
"@hasCommentFilterDescription": {
"description": "Description for the switch to filter engagements based on whether they have a comment."
},
"date": "Date",
"@date": {
Expand Down
Loading