[fractal/notif-msg-types: 3/3] notifications: handle non text messages more gracefully
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/notif-msg-types: 3/3] notifications: handle non text messages more gracefully
- Date: Mon, 15 Jun 2020 06:29:25 +0000 (UTC)
commit ef2d0ac89ae8e7e955026ee12120a982074fed19
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]