Show categories on the user streams for topics.

This commit is contained in:
Robin Ward 2014-05-26 13:49:57 -04:00
parent b1d2aba0f3
commit fc3ce934f5
4 changed files with 12 additions and 2 deletions

View File

@ -30,6 +30,13 @@ _.each(UserActionTypes, function (k, v) {
Discourse.UserAction = Discourse.Model.extend({
_attachCategory: function() {
var categoryId = this.get('category_id');
if (categoryId) {
this.set('category', Discourse.Category.findById(categoryId));
}
}.on('init'),
/**
Return an i18n key we will use for the description text of a user action.

View File

@ -5,6 +5,7 @@
<span class='time'>{{unboundDate path="created_at" leaveAgo="true"}}</span>
<span class="title">
<a href="{{unbound postUrl}}">{{unbound title}}</a>
{{categoryLink category}}
</span>
<span class="type">{{unbound descriptionHtml}}</span>
</div>

View File

@ -116,7 +116,8 @@ SELECT
CASE WHEN coalesce(p.deleted_at, p2.deleted_at, t.deleted_at) IS NULL THEN false ELSE true END deleted,
p.hidden,
p.post_type,
p.edit_reason
p.edit_reason,
t.category_id
FROM user_actions as a
JOIN topics t on t.id = a.target_topic_id
LEFT JOIN posts p on p.id = a.target_post_id

View File

@ -22,7 +22,8 @@ class UserActionSerializer < ApplicationSerializer
:deleted,
:hidden,
:moderator_action,
:edit_reason
:edit_reason,
:category_id
def excerpt
PrettyText.excerpt(object.cooked, 300) if object.cooked