Commit 9bdfa56f93db54dc09b1b831b0f4a917597061bc
1 parent
6f08ff1a
Exists in
master
and in
13 other branches
closes #82
Showing
2 changed files
with
4 additions
and
1 deletions
Show diff stats
src/super_archives/search_indexes.py
| ... | ... | @@ -25,6 +25,9 @@ class ThreadIndex(BaseIndex, indexes.Indexable): |
| 25 | 25 | model_attr='mailinglist__get_absolute_url', |
| 26 | 26 | indexed=False, |
| 27 | 27 | ) |
| 28 | + latest_message_pk = indexes.IntegerField( | |
| 29 | + model_attr='latest_message__pk', indexed=False | |
| 30 | + ) | |
| 28 | 31 | score = indexes.IntegerField(model_attr='score') |
| 29 | 32 | |
| 30 | 33 | def get_model(self): | ... | ... |
src/super_archives/templates/message-preview.html
| ... | ... | @@ -10,7 +10,7 @@ |
| 10 | 10 | {% endif %} |
| 11 | 11 | |
| 12 | 12 | {% if result.title %} |
| 13 | - <a href="{{ result.url }}" {% if result.latest_description %}title="{{ result.latest_description|escape|truncatechars:150 }}"{% elif result.description %}title="{{ result.description|escape|truncatechars:150 }}"{% endif %}> | |
| 13 | + <a href="{{ result.url }}{% if result.type == 'thread' and result.latest_message_pk %}#msg-{{ result.latest_message_pk }}{% elif result.type == 'thread' and result.pk %}#msg-{{ result.pk }}{% endif %}" {% if result.latest_description %}title="{{ result.latest_description|escape|truncatechars:150 }}"{% elif result.description %}title="{{ result.description|escape|truncatechars:150 }}"{% endif %}> | |
| 14 | 14 | <span class="subject"> |
| 15 | 15 | <!-- a striptags filter was raising an error here because using with highlight --> |
| 16 | 16 | {% if query %} | ... | ... |