[fractal/notif-msg-types] notifications: handle non text messages more gracefully
- From: Alexandre Franke <afranke src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/notif-msg-types] notifications: handle non text messages more gracefully
- Date: Sun, 14 Jun 2020 16:04:30 +0000 (UTC)
commit be2d8fe9166b6644f3c3efbd2c4250c6d591e51b
Author: Alexandre Franke <afranke gnome org>
Date: Sun Jun 14 18:03:44 2020 +0200
notifications: handle non text messages more gracefully
fractal-gtk/src/appop/notify.rs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/fractal-gtk/src/appop/notify.rs b/fractal-gtk/src/appop/notify.rs
index 3dee055b..85e0216a 100644
--- a/fractal-gtk/src/appop/notify.rs
+++ b/fractal-gtk/src/appop/notify.rs
@@ -46,7 +46,13 @@ impl AppOp {
let server_url = self.login_data.clone()?.server_url;
let msg = self.get_message_by_id(room_id, id)?;
let r = self.rooms.get(room_id)?;
- let short_body = dirty_truncate(&msg.body, 80).to_string();
+ let short_body = match &msg.mtype[..] {
+ "m.audio" => i18n("An audio file has been added to the conversation."),
+ "m.image" => i18n("An image has been added to the conversation."),
+ "m.video" => i18n("A video has been added to the conversation."),
+ "m.file" => i18n("A file has been added to the conversation."),
+ _ => dirty_truncate(&msg.body, 80).to_string(),
+ };
let title = if r.direct {
i18n(" (direct message)")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]