Commit ebd21cc614fafff2da5fa87edd2c3da16cbf0199
1 parent
83730f73
Exists in
master
and in
11 other branches
proposals_discussion: set cookie on first proposals page
Showing
1 changed file
with
1 additions
and
3 deletions
Show diff stats
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 | ... | ... |