Plugin.DesktopNotification: try harder to show contact details

Show an individual's contact details even when there are multiple new
messages.
This commit is contained in:
Michael Gratton 2020-03-13 08:03:54 +11:00 committed by Michael James Gratton
parent b0e77dc717
commit ff02a13edc

View file

@ -232,21 +232,21 @@ public class Plugin.DesktopNotifications :
// present and it can be loaded, otherwise notify
// generally
bool notified = false;
if (this.email != null &&
added.size == 1) {
try {
Email? message = Geary.Collection.first(
yield this.email.get_email(added, this.cancellable)
);
if (message != null) {
yield notify_specific_message(folder, total, message);
notified = true;
} else {
warning("Could not load email for notification");
}
} catch (GLib.Error error) {
warning("Error loading email for notification: %s", error.message);
try {
Email? message = Geary.Collection.first(
yield this.email.get_email(
Geary.Collection.single(Geary.Collection.first(added)),
this.cancellable
)
);
if (message != null) {
yield notify_specific_message(folder, total, message);
notified = true;
} else {
warning("Could not load email for notification");
}
} catch (GLib.Error error) {
warning("Error loading email for notification: %s", error.message);
}
if (!notified) {