From 0a4c31d39e2653ddd85e43add112319f09b1d55d Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Tue, 22 Dec 2020 23:46:43 -0500 Subject: [PATCH] Fixed issue with poll vote counts not showing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed: - issue with poll vote counts not showing by not including !hide_totals? in poll.rb --- app/javascript/gabsocial/components/poll.js | 7 ++++--- app/models/poll.rb | 2 +- app/serializers/rest/poll_serializer.rb | 5 +---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/javascript/gabsocial/components/poll.js b/app/javascript/gabsocial/components/poll.js index 8f99a237..e2de42a8 100644 --- a/app/javascript/gabsocial/components/poll.js +++ b/app/javascript/gabsocial/components/poll.js @@ -91,9 +91,10 @@ class Poll extends ImmutablePureComponent { flexRow: 1, py10: showResults, mb10: 1, - border1PX: !showResults, - borderColorSecondary: !showResults, - circle: !showResults, + border1PX: !showResults || !!me, + borderColorSecondary: !showResults || !!me, + circle: !showResults || !!me, + overflowHidden: !!me, cursorPointer: !showResults, bgSubtle_onHover: !showResults, bgSubtle: !showResults && active, diff --git a/app/models/poll.rb b/app/models/poll.rb index d4f16ab3..37099917 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -91,6 +91,6 @@ class Poll < ApplicationRecord end def show_totals_now? - expired? + expired? || !hide_totals? end end diff --git a/app/serializers/rest/poll_serializer.rb b/app/serializers/rest/poll_serializer.rb index 356c45b8..1e30e262 100644 --- a/app/serializers/rest/poll_serializer.rb +++ b/app/serializers/rest/poll_serializer.rb @@ -4,7 +4,7 @@ class REST::PollSerializer < ActiveModel::Serializer attributes :id, :expires_at, :expired, :multiple, :votes_count - has_many :loaded_options, key: :options + has_many :loaded_options, key: :options, serializer: REST::PollOptionSerializer has_many :emojis, serializer: REST::CustomEmojiSerializer attribute :voted, if: :current_user? @@ -25,7 +25,4 @@ class REST::PollSerializer < ActiveModel::Serializer !current_user.nil? end - class OptionSerializer < ActiveModel::Serializer - attributes :title, :votes_count - end end