From fa585a8ca4daa6acb32b7513a245d8c46dfc5a83 Mon Sep 17 00:00:00 2001 From: Tallys Martins Date: Wed, 23 Jul 2014 10:31:28 -0300 Subject: [PATCH] User Moderation new support Added support for using User Moderation and Skip user email activation features together --- app/controllers/public/account_controller.rb | 3 +++ app/models/user.rb | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index 1f529ff..4cc0e30 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -124,6 +124,9 @@ class AccountController < ApplicationController self.current_user = @user check_join_in_community(@user) go_to_signup_initial_page + elsif environment.enabled?('skip_new_user_email_confirmation') && environment.enabled?('admin_must_approve_new_users') + session[:notice] = _('Thanks for registering. The administrators were notified.') + redirect_to :controller => 'home', :action => 'index' else @register_pending = true end diff --git a/app/models/user.rb b/app/models/user.rb index 70e20f6..914fc18 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -47,8 +47,17 @@ class User < ActiveRecord::Base user.person = p end - if user.environment.enabled?('skip_new_user_email_confirmation') - user.activate + if user.environment.enabled?('skip_new_user_email_confirmation') + unless user.environment.enabled?('admin_must_approve_new_users') + user.activate + else + @task = CreateUser.new + @task.user_id = user.id + @task.name = user.name + @task.email = user.email + @task.target = user.environment + @task.save + end end end after_create :deliver_activation_code -- libgit2 0.21.2