fix: Forward arbitrary message content

This commit is contained in:
krille-chan 2024-01-14 14:27:05 +01:00
parent e95ed61257
commit c67df2e14f
No known key found for this signature in database
2 changed files with 23 additions and 5 deletions

View file

@ -2409,5 +2409,12 @@
"url": {},
"error": {}
}
},
"forwardMessageTo": "Forward message to {roomName}?",
"@forwardMessageTo": {
"type": "text",
"placeholders": {
"roomName": {}
}
}
}

View file

@ -126,12 +126,23 @@ class ChatListItem extends StatelessWidget {
);
Matrix.of(context).shareContent = null;
} else {
final text = shareContent.tryGet<String>('body');
Matrix.of(context).shareContent = null;
context.go(
'/rooms/${room.id}?body=$text',
final consent = await showOkCancelAlertDialog(
context: context,
title: L10n.of(context)!.forward,
message: L10n.of(context)!.forwardMessageTo(
room.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
),
okLabel: L10n.of(context)!.forward,
cancelLabel: L10n.of(context)!.cancel,
);
return;
if (consent == OkCancelResult.cancel) {
Matrix.of(context).shareContent = null;
return;
}
if (consent == OkCancelResult.ok) {
room.sendEvent(shareContent);
Matrix.of(context).shareContent = null;
}
}
}