Show likes even while logged out.

This commit is contained in:
Robin Ward 2013-02-27 11:21:23 -05:00
parent 0f770260cf
commit 7d6e1f3e1c
3 changed files with 11 additions and 12 deletions

View File

@ -110,13 +110,10 @@ Discourse.Post = Discourse.Model.extend({
actionsHistory: (function() {
if (!this.present('actions_summary')) return null;
return this.get('actions_summary').filter(function(i) {
if (i.get('count') === 0) {
return false;
}
if (i.get('users') && i.get('users').length > 0) {
return true;
}
if (i.get('count') === 0) return false;
if (i.get('users') && i.get('users').length > 0) return true;
return !i.get('hidden');
});
}).property('actions_summary.@each.users', 'actions_summary.@each.count'),

View File

@ -21,6 +21,7 @@ Discourse.ActionsHistoryView = Discourse.View.extend({
// This was creating way too many bound ifs and subviews in the handlebars version.
render: function(buffer) {
if (!this.present('content')) return;
return this.get('content').forEach(function(c) {
var alsoName;

View File

@ -152,13 +152,14 @@ class PostSerializer < ApplicationSerializer
hidden: (sym == :vote),
can_act: scope.post_can_act?(object, sym, taken_actions: post_actions)}
next if !action_summary[:can_act] && !scope.current_user
# The following only applies if you're logged in
if action_summary[:can_act] and scope.current_user.present?
action_summary[:can_clear_flags] = scope.is_admin? && PostActionType.FlagTypes.include?(id)
action_summary[:can_clear_flags] = scope.is_admin? && PostActionType.FlagTypes.include?(id)
if post_actions.present? and post_actions.has_key?(id)
action_summary[:acted] = true
action_summary[:can_undo] = scope.can_delete?(post_actions[id])
if post_actions.present? and post_actions.has_key?(id)
action_summary[:acted] = true
action_summary[:can_undo] = scope.can_delete?(post_actions[id])
end
end
# anonymize flags