Show categories on the user streams for topics.
This commit is contained in:
parent
b1d2aba0f3
commit
fc3ce934f5
|
@ -30,6 +30,13 @@ _.each(UserActionTypes, function (k, v) {
|
||||||
|
|
||||||
Discourse.UserAction = Discourse.Model.extend({
|
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.
|
Return an i18n key we will use for the description text of a user action.
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<span class='time'>{{unboundDate path="created_at" leaveAgo="true"}}</span>
|
<span class='time'>{{unboundDate path="created_at" leaveAgo="true"}}</span>
|
||||||
<span class="title">
|
<span class="title">
|
||||||
<a href="{{unbound postUrl}}">{{unbound title}}</a>
|
<a href="{{unbound postUrl}}">{{unbound title}}</a>
|
||||||
|
{{categoryLink category}}
|
||||||
</span>
|
</span>
|
||||||
<span class="type">{{unbound descriptionHtml}}</span>
|
<span class="type">{{unbound descriptionHtml}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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,
|
CASE WHEN coalesce(p.deleted_at, p2.deleted_at, t.deleted_at) IS NULL THEN false ELSE true END deleted,
|
||||||
p.hidden,
|
p.hidden,
|
||||||
p.post_type,
|
p.post_type,
|
||||||
p.edit_reason
|
p.edit_reason,
|
||||||
|
t.category_id
|
||||||
FROM user_actions as a
|
FROM user_actions as a
|
||||||
JOIN topics t on t.id = a.target_topic_id
|
JOIN topics t on t.id = a.target_topic_id
|
||||||
LEFT JOIN posts p on p.id = a.target_post_id
|
LEFT JOIN posts p on p.id = a.target_post_id
|
||||||
|
|
|
@ -22,7 +22,8 @@ class UserActionSerializer < ApplicationSerializer
|
||||||
:deleted,
|
:deleted,
|
||||||
:hidden,
|
:hidden,
|
||||||
:moderator_action,
|
:moderator_action,
|
||||||
:edit_reason
|
:edit_reason,
|
||||||
|
:category_id
|
||||||
|
|
||||||
def excerpt
|
def excerpt
|
||||||
PrettyText.excerpt(object.cooked, 300) if object.cooked
|
PrettyText.excerpt(object.cooked, 300) if object.cooked
|
||||||
|
|
Loading…
Reference in New Issue