Fix relative sign-up path in e-mail subscription notification (#38527)

This commit is contained in:
Eugen Rochko 2026-04-02 13:14:42 +02:00 committed by GitHub
parent ffcf87e023
commit 8a5d6dab5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 9 deletions

View File

@ -34,11 +34,11 @@ module ApplicationHelper
Setting.registrations_mode == 'none'
end
def available_sign_up_path
def available_sign_up_url
if closed_registrations? || omniauth_only?
'https://joinmastodon.org/#getting-started'
'https://joinmastodon.org/'
else
ENV.fetch('SSO_ACCOUNT_SIGN_UP', new_user_registration_path)
ENV.fetch('SSO_ACCOUNT_SIGN_UP', new_user_registration_url)
end
end

View File

@ -6,7 +6,7 @@
%li= link_to_login t('auth.login')
- if controller_name != 'registrations'
%li= link_to t('auth.register'), available_sign_up_path
%li= link_to t('auth.register'), available_sign_up_url
- if controller_name != 'passwords' && controller_name != 'registrations'
%li= link_to t('auth.forgot_password'), new_user_password_path

View File

@ -27,7 +27,7 @@
/[if mso]
</td><td style="vertical-align:top;">
%div
= render 'application/mailer/button', text: t('.create_account'), url: available_sign_up_path, has_arrow: false
= render 'application/mailer/button', text: t('.create_account'), url: available_sign_up_url, has_arrow: false
/[if mso]
</td></tr></table>

View File

@ -94,14 +94,14 @@ RSpec.describe ApplicationHelper do
end
end
describe 'available_sign_up_path' do
describe 'available_sign_up_url' do
context 'when registrations are closed' do
before do
allow(Setting).to receive(:[]).with('registrations_mode').and_return 'none'
end
it 'redirects to joinmastodon site' do
expect(helper.available_sign_up_path).to match(/joinmastodon.org/)
expect(helper.available_sign_up_url).to match(/joinmastodon.org/)
end
end
@ -113,13 +113,13 @@ RSpec.describe ApplicationHelper do
end
it 'redirects to joinmastodon site' do
expect(helper.available_sign_up_path).to match(/joinmastodon.org/)
expect(helper.available_sign_up_url).to match(/joinmastodon.org/)
end
end
context 'when registrations are allowed' do
it 'returns a link to the registration page' do
expect(helper.available_sign_up_path).to eq(new_user_registration_path)
expect(helper.available_sign_up_url).to eq(new_user_registration_url)
end
end
end