[Xfce4-commits] <postler:master> Don't show reply buttons on Launchpad comments

Christian Dywan noreply at xfce.org
Wed Jul 6 19:38:01 CEST 2011


Updating branch refs/heads/master
         to c6677193d55a1a204a55f2d60c24c48f48a9bcbd (commit)
       from f6d6c14f6bdd5344c03a2b39c2816d61754fbf7e (commit)

commit c6677193d55a1a204a55f2d60c24c48f48a9bcbd
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Jul 6 01:11:09 2011 +0200

    Don't show reply buttons on Launchpad comments

 postler/postler-content.vala |   33 +++++++++++++++++++--------------
 postler/postler-message.vala |    4 ++++
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index c0f35e5..a984007 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -775,21 +775,26 @@ public class Postler.Content : WebKit.WebView {
                     reply_chunk.append (render_plain_text (text_part.body.str, child.project));
                 else
                     reply_chunk.append (child.parts.nth_data (0).body.str);
-                string sender_name = Contact.name_from_string (child.sender);
-                if (sender_name != _("You")) {
-                    reply_chunk.append_printf ("""
-                        <span class="contact">%s</span>
-                    """.printf (
-                    linkify_icon (STOCK_CONTACT_NEW, _("Add contact"), "contact:%s:%s".printf (
-                        sender_name, html_escape (Contact.address_from_string (child.sender))))));
+
+                string? sender_name = null;
+                if (child.can_reply_personally) {
+                    sender_name = Contact.name_from_string (child.sender);
+                    if (sender_name != _("You")) {
+                        reply_chunk.append_printf ("""
+                            <span class="contact">%s</span>
+                        """.printf (
+                        linkify_icon (STOCK_CONTACT_NEW, _("Add contact"), "contact:%s:%s".printf (
+                            sender_name, html_escape (Contact.address_from_string (child.sender))))));
+                    }
+
+                    reply_chunk.append ("""
+                        <div class="actions">
+                        <a href="mailto:%s" class="button">%s</a>
+                        <a href="mailto:%s" class="button">%s</a></div>
+                        """.printf (
+                        html_escape (reply_uri (child, "Re: ")), _("Reply"),
+                        html_escape (reply_uri (child, "Fw: ")), _("Forward")));
                 }
-                reply_chunk.append ("""
-                    <div class="actions">
-                    <a href="mailto:%s" class="button">%s</a>
-                    <a href="mailto:%s" class="button">%s</a></div>
-                    """.printf (
-                    html_escape (reply_uri (child, "Re: ")), _("Reply"),
-                    html_escape (reply_uri (child, "Fw: ")), _("Forward")));
 
                 string reply_markup = reply_chunk.str;
                 /* The extra class importantMessage is Postler-specific */
diff --git a/postler/postler-message.vala b/postler/postler-message.vala
index b9f43fb..3234cf6 100644
--- a/postler/postler-message.vala
+++ b/postler/postler-message.vala
@@ -97,6 +97,7 @@ namespace Postler {
         public GLib.File? avatar { public get; internal set; }
         public string? recipients { public get; set; }
         public string? reply_to { public get; set; }
+        public bool can_reply_personally { public get; set; default = true; }
         public bool unread { public get; set; }
         public bool flagged { public get; set; }
         public bool forwarded { public get; set; }
@@ -350,6 +351,9 @@ namespace Postler {
                         project = stripped.split (";")[0].substring (8);
                     else if (!semicolon)
                         project = stripped;
+                    /* Launchpad doesn't expose the reporter's address */
+                    if (field == "x-launchpad-bug")
+                        can_reply_personally = false;
                 }
                 else if (field == "list-id") {
                     string field_charset = null;



More information about the Xfce4-commits mailing list