Skip to content

Commit

Permalink
fixing profile linking to wrong users - closes TracyWebTech#127
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanP committed Dec 3, 2013
1 parent 7f2a234 commit 44c39e2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
10 changes: 10 additions & 0 deletions src/super_archives/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
26 changes: 17 additions & 9 deletions src/super_archives/templates/message-preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,28 @@
<div class="quiet">
{% if result.fullname or result.modified_by %}
<span class="pull-left">{% trans "by" %}
{% if result.fullname and result.author_url or result.modified_by and result.modified_by_url %}
<a href="{% firstof result.modified_by_url result.author_url %}">
{% if result.modified_by and result.modified_by_url %}
<a href="{{ result.author_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 %}
</a>
{% elif result.fullname and result.author_url %}
<a href="{{ result.modified_by_url }}">
{% if query %}
{% highlight result.modified_by with query %}
{% else %}
{{ result.modified_by }}
{% endif %}
</a>
{% else %}
<span>{{ result.fullname }}</span>
{% if result.modified_by %}
<span>{{ result.modified_by }}</span>
{% else %}
<span>{{ result.fullname }}</span>
{% endif %}
{% endif %}
</span>
{% else %}
Expand Down

0 comments on commit 44c39e2

Please sign in to comment.