Module: NewsmastMastodon::Concerns::AccountsCreation
- Extended by:
- ActiveSupport::Concern
- Includes:
- MoMeHelper, NonChannelHelper, PatchworkHelper
- Defined in:
- app/controllers/newsmast_mastodon/concerns/accounts_creation.rb
Instance Method Summary collapse
Methods included from MoMeHelper
Methods included from PatchworkHelper
#patchwork_community_admin_exist?, #patchwork_server_settings_exist?, #patchwork_table_exists?
Methods included from NonChannelHelper
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/newsmast_mastodon/concerns/accounts_creation.rb', line 9 def create params_with_reason = account_params.merge(reason: "Signing up via #{ ENV.fetch('LOCAL_DOMAIN', nil) } App") token = AppSignUpService.new.call(doorkeeper_token.application, request.remote_ip, params_with_reason) response = Doorkeeper::OAuth::TokenResponse.new(token) headers.merge!(response.headers) self.response_body = Oj.dump(response.body) self.status = response.status create_community_admin unless is_non_channel? generate_opt_token rescue ActiveRecord::RecordInvalid => e render json: ValidationErrorFormatter.new(e, 'account.username': :username, 'invite_request.text': :reason).as_json, status: 422 end |