Commit 531ec92b authored by Aaron Wells's avatar Aaron Wells

Show date & forum name in Elasticsearch forum post search results

Bug 1281847

Change-Id: I8c87b77af8e42f2d405389c07b5b3bf2e8adbd44
parent b7063ffa
......@@ -35,6 +35,8 @@ $string['deletedforumpost'] = 'Deleted forum post';
$string['filterresultsby'] = 'Filter results by';
$string['forum'] = 'Forum';
$string['forumpost'] = 'Forum post';
$string['forumpostedbylabel'] = 'Posted by';
$string['forumpostedby'] = '%s on %s';
$string['forumtopic'] = 'Forum topic';
$string['Group'] = 'Group';
$string['host'] = 'Host';
......
......@@ -2,6 +2,7 @@
<h3 class="title">$record->subject <span class="artefacttype">({str tag=deletedforumpost section=search.elasticsearch})</span></h3>
{else}
<h3 class="title"><a href="{$WWWROOT}interaction/forum/topic.php?id={$record->topic}#post{$record->id}">{$record->subject}</a> <span class="artefacttype">({str tag=forumpost section=search.elasticsearch})</span></h3>
<div class="source"><label>{str tag='forum' section='search.elasticsearch'}:</label> {$record->forumname} ({$record->groupname})</div>
<div class="poster"><label>{str tag='forumpostedbylabel' section='search.elasticsearch'}:</label> {str tag=forumpostedby section=search.elasticsearch arg1='$record->authorlink|safe' arg2='$record->ctime'}</div>
<div class="detail">{$record->body|str_shorten_html:140:true:false|safe}</div>
<div class="poster"><a href="{profile_url($record->poster)}" class="forumuser">{$record->poster|display_name:null:true}</a></div>
{/if}
\ No newline at end of file
......@@ -103,10 +103,15 @@ class ElasticsearchType_interaction_forum_post extends ElasticsearchType
$sql = 'SELECT p1.id, p1.topic, p1.parent, p1.poster, COALESCE(p1.subject, p2.subject) AS subject, p2.subject,
p1.body, p1.ctime, p1.deleted, p1.sent, p1.path,
u.username, u.preferredname, u.firstname, u.lastname, u.profileicon
u.username, u.preferredname, u.firstname, u.lastname, u.profileicon,
f.title as forumname, f.id as forumid,
g.name as groupname, g.id as groupid
FROM {interaction_forum_post} p1
LEFT JOIN {interaction_forum_post} p2 ON p2.parent IS NULL AND p2.topic = p1.topic
LEFT JOIN {usr} u ON u.id = p1.poster
LEFT JOIN {interaction_forum_topic} ift on p1.topic = ift.id
LEFT JOIN {interaction_instance} f ON ift.forum = f.id AND f.plugin=\'forum\'
LEFT JOIN {group} g ON f.group = g.id
WHERE p1.id = ?';
$record = get_record_sql($sql, array($id));
......@@ -115,7 +120,8 @@ class ElasticsearchType_interaction_forum_post extends ElasticsearchType
}
$record->body = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->body));
$record->ctime = format_date(strtotime($record->ctime));
$record->authorlink = '<a href="' . profile_url($record->poster) . '" class="forumuser">' . display_name($record->poster,null,true) . '</a>';
return $record;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment