Commit 44c39e2343cc47a91dc04e0dc2627ad076651770

Authored by Luan
1 parent 7f2a2345

fixing profile linking to wrong users - closes #127

src/super_archives/models.py
... ... @@ -334,6 +334,16 @@ class Message(models.Model):
334 334 return self.from_address.user.get_absolute_url()
335 335 return None
336 336  
  337 + # An alias for author
  338 + @property
  339 + def modified_by(self):
  340 + return self.author
  341 +
  342 + # An alias for author_url
  343 + @property
  344 + def modified_by_url(self):
  345 + return self.author_url
  346 +
337 347 @property
338 348 def fullname(self):
339 349 return self.from_address.get_full_name()
... ...
src/super_archives/templates/message-preview.html
... ... @@ -40,20 +40,28 @@
40 40 <div class="quiet">
41 41 {% if result.fullname or result.modified_by %}
42 42 <span class="pull-left">{% trans "by" %}
43   - {% if result.fullname and result.author_url or result.modified_by and result.modified_by_url %}
44   - <a href="{% firstof result.modified_by_url result.author_url %}">
  43 + {% if result.modified_by and result.modified_by_url %}
  44 + <a href="{{ result.author_url }}">
45 45 {% if query %}
46   - {% if result.modified_by %}
47   - {% highlight result.modified_by with query %}
48   - {% else %}
49   - {% highlight result.fullname with query %}
50   - {% endif %}
  46 + {% highlight result.fullname with query %}
51 47 {% else %}
52   - {% firstof result.modified_by result.fullname %}
  48 + {{ result.fullname }}
  49 + {% endif %}
  50 + </a>
  51 + {% elif result.fullname and result.author_url %}
  52 + <a href="{{ result.modified_by_url }}">
  53 + {% if query %}
  54 + {% highlight result.modified_by with query %}
  55 + {% else %}
  56 + {{ result.modified_by }}
53 57 {% endif %}
54 58 </a>
55 59 {% else %}
56   - <span>{{ result.fullname }}</span>
  60 + {% if result.modified_by %}
  61 + <span>{{ result.modified_by }}</span>
  62 + {% else %}
  63 + <span>{{ result.fullname }}</span>
  64 + {% endif %}
57 65 {% endif %}
58 66 </span>
59 67 {% else %}
... ...