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() { actionsHistory: (function() {
if (!this.present('actions_summary')) return null; if (!this.present('actions_summary')) return null;
return this.get('actions_summary').filter(function(i) { return this.get('actions_summary').filter(function(i) {
if (i.get('count') === 0) { if (i.get('count') === 0) return false;
return false; if (i.get('users') && i.get('users').length > 0) return true;
}
if (i.get('users') && i.get('users').length > 0) {
return true;
}
return !i.get('hidden'); return !i.get('hidden');
}); });
}).property('actions_summary.@each.users', 'actions_summary.@each.count'), }).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. // This was creating way too many bound ifs and subviews in the handlebars version.
render: function(buffer) { render: function(buffer) {
if (!this.present('content')) return; if (!this.present('content')) return;
return this.get('content').forEach(function(c) { return this.get('content').forEach(function(c) {
var alsoName; var alsoName;

View File

@ -152,13 +152,14 @@ class PostSerializer < ApplicationSerializer
hidden: (sym == :vote), hidden: (sym == :vote),
can_act: scope.post_can_act?(object, sym, taken_actions: post_actions)} 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
if post_actions.present? and post_actions.has_key?(id) action_summary[:can_undo] = scope.can_delete?(post_actions[id])
action_summary[:acted] = true end
action_summary[:can_undo] = scope.can_delete?(post_actions[id])
end end
# anonymize flags # anonymize flags