Commit d7e2feb8a6bac3c07262f6a90c7d56991c76d7e0
1 parent
3cd609d0
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
proposals_discussion: set cookie on first proposals page
Showing
1 changed file
with
1 additions
and
3 deletions
Show diff stats
plugins/proposals_discussion/controllers/public/proposals_discussion_plugin_public_controller.rb
... | ... | @@ -2,11 +2,10 @@ class ProposalsDiscussionPluginPublicController < ApplicationController |
2 | 2 | |
3 | 3 | needs_profile |
4 | 4 | |
5 | - before_filter :set_rand_cookie | |
6 | - | |
7 | 5 | def load_proposals |
8 | 6 | holder = profile.articles.find(params[:holder_id]) |
9 | 7 | page = (params[:page] || 1).to_i |
8 | + set_rand_cookie if page == 1 | |
10 | 9 | |
11 | 10 | set_seed |
12 | 11 | @proposals = holder.proposals.public.reorder('random()') |
... | ... | @@ -28,7 +27,6 @@ class ProposalsDiscussionPluginPublicController < ApplicationController |
28 | 27 | end |
29 | 28 | |
30 | 29 | def set_rand_cookie |
31 | - return if cookies[:_noosfero_proposals_discussion_rand_seed].present? | |
32 | 30 | cookies[:_noosfero_proposals_discussion_rand_seed] = {value: rand, expires: Time.now + 600} |
33 | 31 | end |
34 | 32 | ... | ... |