Skip to content

Commit

Permalink
feat: report renote
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon committed Nov 22, 2024
1 parent d88fd1e commit a417cbc
Showing 1 changed file with 49 additions and 2 deletions.
51 changes: 49 additions & 2 deletions lib/view/widget/note_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,8 @@ class NoteSheet extends ConsumerWidget {
t.misskey.reportAbuseOf(name: appearNote.user.acct),
),
initialText: [
if ((appearNote.url ?? appearNote.uri) != null)
'Note: ${appearNote.url ?? appearNote.uri}',
if (appearNote.url ?? appearNote.uri case final url?)
'Note: $url',
'Local Note: $url',
'-----',
'',
Expand Down Expand Up @@ -534,6 +534,53 @@ class NoteSheet extends ConsumerWidget {
}
},
),
if (note.isRenote &&
(note.user.host != null ||
note.user.username != account.username))
ListTile(
leading: const Icon(Icons.report_outlined),
title: Text(t.misskey.reportAbuseRenote),
onTap: () async {
final comment = await showTextFieldDialog(
context,
title: Text(
t.misskey.reportAbuseOf(name: appearNote.user.acct),
),
initialText: [
if (note.uri ?? note.url case final url?) 'Note: $url',
'Local Note: ${Uri.https(account.host, '/notes/$noteId')}',
'-----',
'',
].join('\n'),
decoration: InputDecoration(
helperText: t.misskey.fillAbuseReportDescription,
),
maxLines: null,
);
if (!context.mounted) return;
if (comment == null) return;
final confirmed = await confirm(
context,
title: Text(
t.misskey.reportAbuseOf(name: appearNote.user.acct),
),
message: comment,
okText: t.misskey.reportAbuse,
);
if (!context.mounted) return;
if (confirmed) {
await futureWithDialog(
context,
ref.read(misskeyProvider(account)).users.reportAbuse(
UsersReportAbuseRequest(
userId: appearNote.userId,
comment: comment,
),
),
);
}
},
),
],
],
),
Expand Down

0 comments on commit a417cbc

Please sign in to comment.