1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-21 20:39:22 +00:00

Can report user

This commit is contained in:
Pierre HUBERT 2022-03-18 19:29:26 +01:00
parent 504be2e5ef
commit 64bbce2084

View File

@ -1,8 +1,12 @@
import 'package:comunic/enums/report_target_type.dart';
import 'package:comunic/enums/user_page_visibility.dart';
import 'package:comunic/helpers/friends_helper.dart';
import 'package:comunic/helpers/server_config_helper.dart';
import 'package:comunic/models/advanced_user_info.dart';
import 'package:comunic/models/displayed_content.dart';
import 'package:comunic/models/friend_status.dart';
import 'package:comunic/models/report_target.dart';
import 'package:comunic/ui/dialogs/report_dialog.dart';
import 'package:comunic/ui/widgets/FrienshipStatusWidget.dart';
import 'package:comunic/ui/widgets/async_screen_widget.dart';
import 'package:comunic/ui/widgets/text_widget.dart';
@ -21,7 +25,7 @@ class AboutUserSection extends StatefulWidget {
const AboutUserSection({
Key? key,
required this.user,
}) : super(key: key);
}) : super(key: key);
@override
_AboutUserSectionState createState() => _AboutUserSectionState();
@ -129,6 +133,21 @@ class _AboutUserSectionState extends State<AboutUserSection> {
? tr("Public page")!
: tr("Private page")!)),
),
// Report user
!widget.user.isCurrentUser && srvConfig!.isReportingEnabled
? ListTile(
textColor: Colors.red,
leading: Icon(Icons.flag, color: Colors.red),
title: Text(tr("Report abuse")!),
onTap: _reportAbuse,
)
: Container(),
],
);
/// Report user
void _reportAbuse() => showReportDialog(
ctx: context,
target: ReportTarget(ReportTargetType.User, widget.user.id));
}