Commits

Mike Bayer  committed 5d6f5ac

- Added support for gravatar in
"ticket comment diff" screen.

  • Participants
  • Parent commits 01b67a9
  • Tags rel_1_7

Comments (0)

Files changed (4)

+1.7
+---
+- Added support for gravatar in
+  "ticket comment diff" screen.
+
 1.6
 ---
 - Fixed bug where a NULL stored as the

File tracvatar/__init__.py

-__version__ = '1.6'
+__version__ = '1.7'

File tracvatar/htdocs/tracvatar.css

   margin:0 5px 5px 0;
 }
 
+img.tracvatar.ticket-comment-diff {
+  margin:0 5px 5px 0;
+}
+
 img.tracvatar.browser-lineitem {
   margin:0 5px 0 0;
 }

File tracvatar/web_ui.py

 
     ticket_reporter_size = Option("tracvatar", "ticket_reporter_size", default="60")
     ticket_comment_size = Option("tracvatar", "ticket_comment_size", default="40")
+    ticket_comment_diff_size = Option("tracvatar", "ticket_comment_size", default="40")
     timeline_size = Option("tracvatar", "timeline_size", default="30")
     browser_lineitem_size = Option("tracvatar", "browser_lineitem_size", default="20")
     browser_changeset_size = Option("tracvatar", "browser_changeset_size", default="40")
             data = data
         )
         if req.path_info.startswith("/ticket"):
-            filter_.append(self._ticket_reporter_filter(context))
-            filter_.append(self._ticket_comment_filter(context))
+            if "action=comment-diff" in req.query_string:
+                filter_.append(self._ticket_comment_diff_filter(context))
+            else:
+                filter_.append(self._ticket_reporter_filter(context))
+                filter_.append(self._ticket_comment_filter(context))
         elif req.path_info.startswith("/timeline"):
             filter_.append(self._timeline_filter(context))
         elif req.path_info.startswith("/browser"):
         return Transformer('//div[@id="changelog"]/div[@class="change"]/h3[@class="change"]').\
                         filter(find_change)
 
+    def _ticket_comment_diff_filter(self, context):
+        data, author_data = context['data'], context['author_data']
+
+        author = data['change']['author']
+        author_data[author] = None
+        return lambda stream: Transformer('//dd[@class="author"]').prepend(
+            self._generate_avatar(
+                    context,
+                    author,
+                    "ticket-comment-diff",
+                    self.ticket_comment_diff_size)
+        )(stream)
+
     def _timeline_filter(self, context):
         data, author_data = context['data'], context['author_data']
         if 'events' not in data: