fix: Remove failed to sent events
This commit is contained in:
parent
e70ff68c48
commit
9f0bcd5523
3 changed files with 61 additions and 23 deletions
|
|
@ -772,6 +772,24 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
);
|
||||
}
|
||||
|
||||
void deleteErrorEventsAction() async {
|
||||
try {
|
||||
if (selectedEvents.any((event) => event.status != EventStatus.error)) {
|
||||
throw Exception(
|
||||
'Tried to delete failed to send events but one event is not failed to sent',
|
||||
);
|
||||
}
|
||||
for (final event in selectedEvents) {
|
||||
await event.remove();
|
||||
}
|
||||
} catch (e, s) {
|
||||
ErrorReporter(
|
||||
context,
|
||||
'Error while delete error events action',
|
||||
).onErrorCallback(e, s);
|
||||
}
|
||||
}
|
||||
|
||||
void redactEventsAction() async {
|
||||
final reasonInput = selectedEvents.any((event) => event.status.isSent)
|
||||
? await showTextInputDialog(
|
||||
|
|
@ -832,6 +850,7 @@ class ChatController extends State<ChatPageWithRoom> {
|
|||
if (isArchived) return false;
|
||||
final clients = Matrix.of(context).currentBundle;
|
||||
for (final event in selectedEvents) {
|
||||
if (!event.status.isSent) return false;
|
||||
if (event.canRedact == false &&
|
||||
!(clients!.any((cl) => event.senderId == cl!.userID))) return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue