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:
parent
8e153d6350
commit
131c0a8668
2 changed files with 6 additions and 4 deletions
|
@ -7,8 +7,8 @@ class Platform::Api::V1::UsersController < PlatformController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@resource = (User.find_by(email: user_params[:email]) || User.new(user_params))
|
@resource = (User.find_by(email: user_params[:email]) || User.new(user_params))
|
||||||
|
@resource.skip_confirmation!
|
||||||
@resource.save!
|
@resource.save!
|
||||||
@resource.confirm
|
|
||||||
@platform_app.platform_app_permissibles.find_or_create_by!(permissible: @resource)
|
@platform_app.platform_app_permissibles.find_or_create_by!(permissible: @resource)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,11 @@ RSpec.describe 'Platform Users API', type: :request do
|
||||||
let(:platform_app) { create(:platform_app) }
|
let(:platform_app) { create(:platform_app) }
|
||||||
|
|
||||||
it 'creates a new user and permissible for the user' do
|
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!',
|
expect do
|
||||||
custom_attributes: { test: 'test_create' } },
|
post '/platform/api/v1/users/', params: { name: 'test', email: 'test@test.com', password: 'Password1!',
|
||||||
headers: { api_access_token: platform_app.access_token.token }, as: :json
|
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)
|
expect(response).to have_http_status(:success)
|
||||||
data = JSON.parse(response.body)
|
data = JSON.parse(response.body)
|
||||||
|
|
Loading…
Reference in a new issue