From 44c39e2343cc47a91dc04e0dc2627ad076651770 Mon Sep 17 00:00:00 2001 From: Luan Date: Tue, 3 Dec 2013 09:18:50 -0200 Subject: [PATCH] fixing profile linking to wrong users - closes #127 --- src/super_archives/models.py | 10 +++++++ .../templates/message-preview.html | 26 ++++++++++++------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/super_archives/models.py b/src/super_archives/models.py index 82089a10..6e4c35db 100644 --- a/src/super_archives/models.py +++ b/src/super_archives/models.py @@ -334,6 +334,16 @@ def author_url(self): return self.from_address.user.get_absolute_url() return None + # An alias for author + @property + def modified_by(self): + return self.author + + # An alias for author_url + @property + def modified_by_url(self): + return self.author_url + @property def fullname(self): return self.from_address.get_full_name() diff --git a/src/super_archives/templates/message-preview.html b/src/super_archives/templates/message-preview.html index f875a681..6eee4c2a 100644 --- a/src/super_archives/templates/message-preview.html +++ b/src/super_archives/templates/message-preview.html @@ -40,20 +40,28 @@
{% if result.fullname or result.modified_by %} {% trans "by" %} - {% if result.fullname and result.author_url or result.modified_by and result.modified_by_url %} - + {% if result.modified_by and result.modified_by_url %} + {% if query %} - {% if result.modified_by %} - {% highlight result.modified_by with query %} - {% else %} - {% highlight result.fullname with query %} - {% endif %} + {% highlight result.fullname with query %} {% else %} - {% firstof result.modified_by result.fullname %} + {{ result.fullname }} + {% endif %} + + {% elif result.fullname and result.author_url %} + + {% if query %} + {% highlight result.modified_by with query %} + {% else %} + {{ result.modified_by }} {% endif %} {% else %} - {{ result.fullname }} + {% if result.modified_by %} + {{ result.modified_by }} + {% else %} + {{ result.fullname }} + {% endif %} {% endif %} {% else %}