Commit 6ed2fbe7ba301e74fe00754202bab309a0ddfa61
1 parent
02b13044
Exists in
master
and in
29 other branches
create_topics: saving number of access to db
Also fixed typo (ActionItem2997)
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -29,9 +29,9 @@ class CmsController < MyProfileController |
29 | 29 | end |
30 | 30 | |
31 | 31 | protect_if :only => :new do |c, user, profile| |
32 | - article_id = c.params[:parent_id] | |
33 | - (!article_id.blank? && (profile.articles.find(article_id).allow_create?(user) || profile.articles.find(article_id).parent.allow_create?(user))) || | |
34 | - (user && (user.has_permission?('post_content', profile) || user.has_permission?('publish_content', profile))) | |
32 | + article = profile.articles.find_by_id(c.params[:parent_id]) | |
33 | + (!article.nil? && (article.allow_create?(user) || article.parent.allow_create?(user))) || | |
34 | + (user && (user.has_permission?('post_content', profile) || user.has_permission?('publish_content', profile))) | |
35 | 35 | end |
36 | 36 | |
37 | 37 | protect_if :only => [:destroy, :publish] do |c, user, profile| | ... | ... |
app/helpers/article_helper.rb
... | ... | @@ -55,7 +55,7 @@ module ArticleHelper |
55 | 55 | content_tag( |
56 | 56 | 'div', |
57 | 57 | check_box(:article, :allows_members_to_create_topics) + |
58 | - content_tag('label', _('Allow member to create topics'), :for => 'article_allows_members_to_create_topics') | |
58 | + content_tag('label', _('Allow members to create topics'), :for => 'article_allows_members_to_create_topics') | |
59 | 59 | ) : '') |
60 | 60 | ) |
61 | 61 | end | ... | ... |