diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 3ea338b..cdea786 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -71,7 +71,6 @@ class CmsController < MyProfileController def index @article = nil - @portal_enabled = environment.portal_community && environment.enabled?('use_portal_community') @articles = profile.top_level_articles.paginate( :order => "case when type = 'Folder' then 0 when type ='Blog' then 1 else 2 end, updated_at DESC", :per_page => per_page, @@ -266,7 +265,6 @@ class CmsController < MyProfileController def publish @article = profile.articles.find(params[:id]) - @portal_enabled = environment.portal_community && environment.enabled?('use_portal_community') record_coming @failed = {} if request.post? @@ -321,7 +319,7 @@ class CmsController < MyProfileController def publish_on_portal_community if request.post? @article = profile.articles.find(params[:id]) - if environment.portal_community && environment.enabled?('use_portal_community') + if environment.portal_enabled task = ApproveArticle.create!(:article => @article, :name => params[:name], :target => environment.portal_community, :requestor => user) begin task.finish unless environment.portal_community.moderated_articles? diff --git a/app/models/environment.rb b/app/models/environment.rb index 0a3fa6a..6b97906 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -806,6 +806,10 @@ class Environment < ActiveRecord::Base "home-page-news/#{cache_key}-#{language}" end + def portal_enabled + portal_community && enabled?('use_portal_community') + end + def notification_emails [contact_email].select(&:present?) + admins.map(&:email) end diff --git a/app/views/cms/publish.html.erb b/app/views/cms/publish.html.erb index 82ad473..e801003 100644 --- a/app/views/cms/publish.html.erb +++ b/app/views/cms/publish.html.erb @@ -67,7 +67,7 @@ <% end %> - <% if @portal_enabled %> + <% if environment.portal_enabled %>
  • <%= _("Publish your article on portal community") %>
    <%= _('You can suggest this article to the portal community, where it can show up on the homepage.') %>
    -- libgit2 0.21.2