chore: Don't send confirmation email when creating User via platform api (#4272)

The platform api automatically confirms users so we don't need to send this
email.
This commit is contained in:
Jordan Brough 2022-03-24 13:06:59 -06:00 committed by GitHub
parent 8e153d6350
commit 131c0a8668
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -7,8 +7,8 @@ class Platform::Api::V1::UsersController < PlatformController
def create
@resource = (User.find_by(email: user_params[:email]) || User.new(user_params))
@resource.skip_confirmation!
@resource.save!
@resource.confirm
@platform_app.platform_app_permissibles.find_or_create_by!(permissible: @resource)
end

View file

@ -95,9 +95,11 @@ RSpec.describe 'Platform Users API', type: :request do
let(:platform_app) { create(:platform_app) }
it 'creates a new user and permissible for the user' do
post '/platform/api/v1/users/', params: { name: 'test', email: 'test@test.com', password: 'Password1!',
custom_attributes: { test: 'test_create' } },
headers: { api_access_token: platform_app.access_token.token }, as: :json
expect do
post '/platform/api/v1/users/', params: { name: 'test', email: 'test@test.com', password: 'Password1!',
custom_attributes: { test: 'test_create' } },
headers: { api_access_token: platform_app.access_token.token }, as: :json
end.not_to enqueue_mail
expect(response).to have_http_status(:success)
data = JSON.parse(response.body)