Fix search highlighting for message content and topics

Previously topics weren't being highlighted at all and messages had their
highlighting persist across different narrows (because we were only checking
whether the message object had a match_content property, not whether it should
currently be used).

(imported from commit 44c91c6d5799dcdf765e19e1a17bd727ce80c918)
This commit is contained in:
Zev Benjamin
2014-02-25 18:19:20 -05:00
committed by Jessica McKellar
parent 865c57fa72
commit a547043831
3 changed files with 6 additions and 4 deletions

View File

@@ -126,6 +126,7 @@ MessageListView.prototype = {
current_group.color_class = stream_color.get_color_class(current_group.background_color);
current_group.invite_only = stream_data.get_invite_only(first_message.stream);
current_group.subject = first_message.subject;
current_group.match_subject = first_message.match_subject;
} else if (current_group.is_private) {
current_group.pm_with_url = first_message.pm_with_url;
current_group.display_reply_to = first_message.display_reply_to;
@@ -245,7 +246,8 @@ MessageListView.prototype = {
}
var rendered_groups = $(templates.render('message_group', {
message_groups: new_message_groups
message_groups: new_message_groups,
use_match_properties: self.list.filter.is_search()
}));
var rendered_messages = [];

View File

@@ -37,7 +37,7 @@
<a class="message_label_clickable narrows_by_subject"
href="{{topic_url}}"
title="Narrow to stream &quot;{{display_recipient}}&quot;, topic &quot;{{subject}}&quot;">
{{#if ../../../../../use_match_properties}}
{{#if ../../../use_match_properties}}
{{{match_subject}}}
{{else}}
{{subject}}
@@ -82,7 +82,7 @@
{{/if}}
{{#each messages}}
{{#with this}}
{{partial "single_message"}}
{{partial "single_message" "use_match_properties" ../../../../use_match_properties}}
{{/with}}
{{/each}}
</div>

View File

@@ -30,7 +30,7 @@
</div>
</div>
</div>
<div class="message_content">{{#unless status_message}}{{#if match_content}}{{{match_content}}}{{else}}{{{content}}}{{/if}}{{/unless}}</div>
<div class="message_content">{{#unless status_message}}{{#if use_match_properties}}{{{match_content}}}{{else}}{{{content}}}{{/if}}{{/unless}}</div>
{{#if last_edit_timestr}}
{{#unless include_sender}}
<div class="message_edit_notice" title="Edited ({{last_edit_timestr}})">EDITED</div>