[geary/wip/135-contact-popovers: 15/26] Only hide email address when displaying a contact name if it is trusted



commit 948ed5f95e1199e83291430be99a2e98ce47ff21
Author: Michael Gratton <mike vee net>
Date:   Sat Mar 16 17:59:37 2019 +1100

    Only hide email address when displaying a contact name if it is trusted

 src/client/application/application-contact.vala          | 10 ++++++++++
 src/client/conversation-viewer/conversation-message.vala |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/client/application/application-contact.vala b/src/client/application/application-contact.vala
index c0f58345..d504f42b 100644
--- a/src/client/application/application-contact.vala
+++ b/src/client/application/application-contact.vala
@@ -25,6 +25,14 @@ public class Application.Contact : Geary.BaseObject {
     /** Determines if this contact was loaded from Folks. */
     public bool is_desktop_contact { get; private set; default = false; }
 
+    /**
+     * Determines if this contact is trusted.
+     *
+     * Contacts loaded from Folks that are trusted are trusted, all
+     * other contacts are not.
+     */
+    public bool is_trusted { get; private set; default = false; }
+
     /**
      * Determines if this contact has been marked as a favourite.
      */
@@ -135,12 +143,14 @@ public class Application.Contact : Geary.BaseObject {
         if (this.individual != null) {
             this.display_name = this.individual.display_name;
             this.is_favourite = this.individual.is_favourite;
+            this.is_trusted = (this.individual.trust_level == PERSONAS);
             this.is_desktop_contact = true;
         } else {
             if (this.contact != null) {
                 this.display_name = this.contact.real_name;
             }
             this.is_favourite = false;
+            this.is_trusted = false;
             this.is_desktop_contact = false;
         }
     }
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 2649284d..47941785 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -154,7 +154,7 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
                 this.displayed = new Geary.RFC822.MailboxAddress(
                     null, this.source.address
                 );
-            } else if (this.contact.is_desktop_contact) {
+            } else if (this.contact.is_trusted) {
                 // The contact's name can be trusted, so no need to
                 // display the email address
                 primary.set_text(this.contact.display_name);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]