1
0
Fork 1
mirror of https://github.com/mastodon/mastodon.git synced 2024-12-28 03:03:27 +00:00

Fix HTTP 500 in /api/v1/emails/check_confirmation ()

This commit is contained in:
Daniel M Brasil 2023-07-01 19:05:44 -03:00 committed by GitHub
parent cea9db5a0b
commit 4fe2d7cb59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions
app/controllers/api/v1/emails
spec/controllers/api/v1/emails

View file

@ -5,6 +5,7 @@ class Api::V1::Emails::ConfirmationsController < Api::BaseController
before_action -> { doorkeeper_authorize! :write, :'write:accounts' }, except: :check
before_action :require_user_owned_by_application!, except: :check
before_action :require_user_not_confirmed!, except: :check
before_action :require_authenticated_user!, only: :check
def create
current_user.update!(email: params[:email]) if params.key?(:email)

View file

@ -130,5 +130,13 @@ RSpec.describe Api::V1::Emails::ConfirmationsController do
end
end
end
context 'without an oauth token and an authentication cookie' do
it 'returns http unauthorized' do
get :check
expect(response).to have_http_status(401)
end
end
end
end