diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-03-07 22:53:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 22:53:47 +0100 |
commit | 054bbb3da21b2c76374eb921cba862adb8d5a0b3 (patch) | |
tree | 61e4ea5e735631b6e947ca00884588ca184e8ab6 /app/views | |
parent | 75cb93676b1dd41d3e47f62466c0c6430691a990 (diff) |
Immediately display poll results to poll author (#10187)
* Immediately display poll results to poll author * Refactor Poll#loaded_options and add Poll#voted? to improve DRYness
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/stream_entries/_poll.html.haml | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/views/stream_entries/_poll.html.haml b/app/views/stream_entries/_poll.html.haml index dad04b79c..d6b2c0cd9 100644 --- a/app/views/stream_entries/_poll.html.haml +++ b/app/views/stream_entries/_poll.html.haml @@ -1,10 +1,8 @@ -- options = (!poll.expired? && poll.hide_totals?) ? poll.unloaded_options : poll.loaded_options -- voted = user_signed_in? && poll.votes.where(account: current_account).exists? -- show_results = voted || poll.expired? +- show_results = (user_signed_in? && poll.voted?(current_account)) || poll.expired? .poll %ul - - options.each do |option| + - poll.loaded_options.each do |option| %li - if show_results - percent = poll.votes_count > 0 ? 100 * option.votes_count / poll.votes_count : 0 |