mirror of
https://github.com/mastodon/mastodon.git
synced 2026-10-20 15:44:59 -05:00
Add invitation support to OAuth-signup code through invite_code parameter
This commit is contained in:
@@ -41,7 +41,7 @@ class OAuth::AuthorizationsController < Doorkeeper::AuthorizationsController
|
||||
if params['prompt'] == 'create' && !current_user
|
||||
session[:registration_app_id] = Doorkeeper::OAuth::Client.find(params[:client_id]).id
|
||||
|
||||
return redirect_to(new_user_registration_path)
|
||||
return redirect_to(new_user_registration_path(params.permit(:invite_code)))
|
||||
end
|
||||
|
||||
super
|
||||
|
||||
@@ -165,10 +165,11 @@ RSpec.describe 'Using OAuth from an external app' do
|
||||
|
||||
context 'when creating a new user' do
|
||||
let(:params) do
|
||||
{ client_id: client_app.uid, response_type: 'code', redirect_uri: client_app.redirect_uri, scope: 'read', prompt: 'create' }
|
||||
{ client_id: client_app.uid, response_type: 'code', redirect_uri: client_app.redirect_uri, scope: 'read', prompt: 'create', invite_code: invite.code }
|
||||
end
|
||||
|
||||
let!(:rule) { Fabricate :rule, text: 'You must be seven meters tall' }
|
||||
let(:invite) { Fabricate :invite, autofollow: true }
|
||||
|
||||
it 'allows creating a new user' do
|
||||
subject
|
||||
@@ -183,6 +184,7 @@ RSpec.describe 'Using OAuth from an external app' do
|
||||
# It presents the user with a sign-up page
|
||||
expect(page)
|
||||
.to have_text(I18n.t('auth.register'))
|
||||
.and have_text(I18n.t('invites.invited_by'))
|
||||
|
||||
# Avoid the registration spam check
|
||||
travel_to 10.seconds.from_now
|
||||
|
||||
Reference in New Issue
Block a user