Add reporting functionality

This commit is contained in:
Henry Hiles 2025-12-26 17:56:21 -05:00
commit cd61509f75
No known key found for this signature in database
4 changed files with 82 additions and 2 deletions

View file

@ -35,6 +35,7 @@ class RoomChat extends HookConsumerWidget {
final replyToMessage = useState<Message?>(null);
final memberListOpened = useState<bool>(showMembersByDefault);
final theme = Theme.of(context);
final danger = theme.colorScheme.error;
return ref
.watch(SelectedRoomController.provider)
@ -120,6 +121,37 @@ class RoomChat extends HookConsumerWidget {
title: Text("Delete"),
),
),
PopupMenuItem(
onTap: () => showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text("Report"),
content: Text(
"Report this message to your server administrators, who can take action like banning that user or blocking that server from federating.",
),
actions: [
TextButton(
onPressed: Navigator.of(context).pop,
child: Text("Cancel"),
),
TextButton(
onPressed: () {
room.roomData.client.reportEvent(
room.roomData.id,
message.id,
);
Navigator.of(context).pop();
},
child: Text("Report"),
),
],
),
),
child: ListTile(
leading: Icon(Icons.report, color: danger),
title: Text("Report", style: TextStyle(color: danger)),
),
),
];
return Scaffold(