changeset 767:063385cbbfc2

browser_side (blog): display author_jid in addition to author
author souliane <souliane@mailoo.org>
date Wed, 25 Nov 2015 16:49:31 +0100
parents dd70db1c48dc
children 6c89dfdba563
files src/browser/sat_browser/blog.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/blog.py	Wed Nov 25 16:48:28 2015 +0100
+++ b/src/browser/sat_browser/blog.py	Wed Nov 25 16:49:31 2015 +0100
@@ -106,11 +106,22 @@
     def _setHeader(self):
         """Set the entry header."""
         if not self.new:
+            author = html_tools.html_sanitize(unicode(self.item.author))
+            author_jid = html_tools.html_sanitize(unicode(self.item.author_jid))
+            if author_jid and not self.item.author_verified:
+                author_jid += u' <span style="color=red; font-weight: bold;">⚠</span>'
+            if author:
+                author += " &lt;%s&gt;" % author_jid
+            elif author_jid:
+                author = author_jid
+            else:
+                author = _("<unknown author>")
+
             update_text = u" — ✍ " + "<span class='mb_entry_timestamp'>%s</span>" % datetime.fromtimestamp(self.item.updated)
             self.header.add(HTML("""<span class='mb_entry_header_info'>
                                       <span class='mb_entry_author'>%(author)s</span> on
                                       <span class='mb_entry_timestamp'>%(published)s</span>%(updated)s
-                                    </span>""" % {'author': html_tools.html_sanitize(unicode(self.item.author)),
+                                    </span>""" % {'author': author,
                                                   'published': datetime.fromtimestamp(self.item.published) if self.item.published is not None else '',
                                                   'updated': update_text if self.item.published != self.item.updated else ''
                                                   }))