diff --git a/CHANGELOG.md b/CHANGELOG.md index 22c0485..f06c72b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated all dependencies +### Changed + + - Notifications for group messages now display the name of the group instead of just the name of the sender. + ## [0.6.0] - 2023-01-13 ### Added diff --git a/src/backend/message/display_message.rs b/src/backend/message/display_message.rs index 15fd7f1..47b574f 100644 --- a/src/backend/message/display_message.rs +++ b/src/backend/message/display_message.rs @@ -10,14 +10,26 @@ glib::wrapper! { impl DisplayMessage { pub fn send_notification(&self) { let sender = self.sender(); + let channel = self.channel(); let body = self.textual_description(); if sender.is_self() || body.is_none() || body.as_ref().unwrap().is_empty() { // Skip notifications for messages sent from self or empty messages. return; } - - let notification = gio::Notification::new(&sender.title()); - notification.set_body(body.as_deref()); + let notification_title; + let notification_body; + if channel.group_context().is_some() { + notification_title = channel.title().to_string(); + notification_body = format!("{}: {}", + sender.title().to_string(), + body.as_ref().unwrap().to_string()); + } + else { + notification_title = sender.title().to_string(); + notification_body = body.as_ref().unwrap().to_string(); + } + let notification = gio::Notification::new(¬ification_title); + notification.set_body(Some(¬ification_body)); let icon = Pixbuf::from_resource("/icon.png").expect("Flare to have an application icon"); notification.set_icon(&icon);