From f405dad85bff479af1ea6594e23b33aa451166dd Mon Sep 17 00:00:00 2001 From: Parley Martins Date: Tue, 4 Nov 2014 16:02:08 -0200 Subject: [PATCH] Fix new software creation when communities are moderated. --- controllers/mpog_software_plugin_myprofile_controller.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/controllers/mpog_software_plugin_myprofile_controller.rb b/controllers/mpog_software_plugin_myprofile_controller.rb index 54189c7..fa790a2 100644 --- a/controllers/mpog_software_plugin_myprofile_controller.rb +++ b/controllers/mpog_software_plugin_myprofile_controller.rb @@ -28,7 +28,7 @@ class MpogSoftwarePluginMyprofileController < MyProfileController valid_community = request.post? && @community.valid? valid_software_info = request.post? && @software_info.valid? valid_license = (request.post? && @license_info.valid?) - if valid_software_info && valid_license && valid_community + if valid_software_info && valid_license && valid_community @community = Community.create_after_moderation(user, {:environment => environment}.merge(params[:community]), @software_info, @license_info ) unless params[:q].nil? @@ -40,7 +40,12 @@ class MpogSoftwarePluginMyprofileController < MyProfileController end end - redirect_to :controller => 'profile_editor', :action => 'edit', :profile => @community.identifier + if environment.enabled?("admin_must_approve_new_communities") + session[:notice] = _('Your new software request will be evaluated by an administrator. You will be notified.') + redirect_to user.admin_url + else + redirect_to :controller => 'profile_editor', :action => 'edit', :profile => @community.identifier + end else # @list_libraries.each do |lib| # @errors |= lib.errors.full_messages @@ -140,4 +145,6 @@ class MpogSoftwarePluginMyprofileController < MyProfileController environment.admins.include?(current_user.person) end + def community_must_be_approved + end end -- libgit2 0.21.2