Commit 26f8889c250391f4adc61178129e9396b05dae98
1 parent
67e3c824
Exists in
master
and in
11 other branches
proposals_discussion: fix cache issues
Showing
4 changed files
with
16 additions
and
1 deletions
Show diff stats
lib/proposals_discussion_plugin/discussion.rb
... | ... | @@ -21,4 +21,9 @@ class ProposalsDiscussionPlugin::Discussion < Folder |
21 | 21 | end |
22 | 22 | end |
23 | 23 | |
24 | + def cache_key_with_person(params = {}, user = nil, language = 'en') | |
25 | + cache_key_without_person + (user ? "-#{user.identifier}" : '') | |
26 | + end | |
27 | + alias_method_chain :cache_key, :person | |
28 | + | |
24 | 29 | end | ... | ... |
lib/proposals_discussion_plugin/proposal.rb
... | ... | @@ -33,4 +33,9 @@ class ProposalsDiscussionPlugin::Proposal < TinyMceArticle |
33 | 33 | (score/holder.max_score.to_f).round(2) |
34 | 34 | end |
35 | 35 | |
36 | + def cache_key_with_person(params = {}, user = nil, language = 'en') | |
37 | + cache_key_without_person + (user && created_by == user ? "-#{user.identifier}" : '') | |
38 | + end | |
39 | + alias_method_chain :cache_key, :person | |
40 | + | |
36 | 41 | end | ... | ... |
lib/proposals_discussion_plugin/topic.rb
... | ... | @@ -51,4 +51,9 @@ class ProposalsDiscussionPlugin::Topic < Folder |
51 | 51 | proposals.joins(:comments).group('date(comments.created_at)').count('comments.id') |
52 | 52 | end |
53 | 53 | |
54 | + def cache_key_with_person(params = {}, user = nil, language = 'en') | |
55 | + cache_key_without_person + (user ? "-#{user.identifier}" : '') | |
56 | + end | |
57 | + alias_method_chain :cache_key, :person | |
58 | + | |
54 | 59 | end | ... | ... |
views/content_viewer/proposal.html.erb
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | <div class="content"><%= @page.body %></div> |
23 | 23 | </div> |
24 | 24 | |
25 | -<% if @page.allow_edit?(user) && !@page.published %> | |
25 | +<% if @page.created_by == user && !@page.published %> | |
26 | 26 | <div class="actions"> |
27 | 27 | <%= link_to url_for({:controller => 'proposals_discussion_plugin_myprofile', :action => 'publish_proposal', :proposal_id => @page.id}), :class => 'button with-text icon-suggest' do %> |
28 | 28 | <strong><%= _("Publish") %></strong> | ... | ... |