about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-10-03 17:50:59 +0200
committerGitHub <noreply@github.com>2019-10-03 17:50:59 +0200
commiteb83d6256e6dc5d9c93dcb2b0a55e1061fee735f (patch)
tree942872aa35182fb748e40a61173ed708f0a983f1 /app/services
parent9a1be333b8f2a1bb2a25e77053efa16c3e30f068 (diff)
Add `reason` param to `POST /api/v1/accounts` REST API (#12064)
For approval-required registrations mode
Diffstat (limited to 'app/services')
-rw-r--r--app/services/app_sign_up_service.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/services/app_sign_up_service.rb b/app/services/app_sign_up_service.rb
index 6dee9cd81..c9739c77d 100644
--- a/app/services/app_sign_up_service.rb
+++ b/app/services/app_sign_up_service.rb
@@ -4,9 +4,10 @@ class AppSignUpService < BaseService
   def call(app, params)
     return unless allowed_registrations?
 
-    user_params    = params.slice(:email, :password, :agreement, :locale)
-    account_params = params.slice(:username)
-    user           = User.create!(user_params.merge(created_by_application: app, password_confirmation: user_params[:password], account_attributes: account_params))
+    user_params           = params.slice(:email, :password, :agreement, :locale)
+    account_params        = params.slice(:username)
+    invite_request_params = { text: params[:reason] }
+    user                  = User.create!(user_params.merge(created_by_application: app, password_confirmation: user_params[:password], account_attributes: account_params, invite_request_attributes: invite_request_params))
 
     Doorkeeper::AccessToken.create!(application: app,
                                     resource_owner_id: user.id,