diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb index b315b273d58..16cd092ecfa 100644 --- a/app/controllers/auth/registrations_controller.rb +++ b/app/controllers/auth/registrations_controller.rb @@ -13,7 +13,6 @@ class Auth::RegistrationsController < Devise::RegistrationsController before_action :set_strikes, only: [:edit, :update] before_action :require_not_suspended!, only: [:update] before_action :set_rules, only: :new - before_action :require_rules_acceptance!, only: :new before_action :set_registration_form_time, only: :new skip_before_action :check_self_destruct!, only: [:edit, :update] @@ -127,16 +126,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController def set_rules @rules = Rule.ordered.includes(:translations) - end - - def require_rules_acceptance! - return if @rules.empty? || validated_accept_token? - - @accept_token = session[:accept_token] = SecureRandom.hex - @invite_code = invite_code @rule_translations = @rules.map { |rule| rule.translation_for(I18n.locale) } - - render :rules end def validated_accept_token? diff --git a/app/javascript/styles/mastodon/about.scss b/app/javascript/styles/mastodon/about.scss index 0bb2c8c9eb2..147111ec20d 100644 --- a/app/javascript/styles/mastodon/about.scss +++ b/app/javascript/styles/mastodon/about.scss @@ -34,39 +34,11 @@ $fluid-breakpoint: $maximum-width + 20px; counter-increment: list-counter; min-height: 4ch; - button { - background: transparent; - border: 0; - padding: 0; - margin: 0; - text-align: start; - font: inherit; - - &:hover, - &:focus, - &:active { - background: transparent; - } - - &[aria-expanded='false'] .rules-list__hint { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - - @supports (-webkit-line-clamp: 2) { - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - white-space: normal; - } - } - } - &::before { content: counter(list-counter); position: absolute; inset-inline-start: 0; - top: 1em; + top: 1.3em; background: var(--color-bg-brand-base); color: var(--color-text-on-brand-base); border-radius: 50%; @@ -91,6 +63,7 @@ $fluid-breakpoint: $maximum-width + 20px; font-size: 14px; font-weight: 400; color: var(--color-text-secondary); + margin-top: 4px; } } diff --git a/app/javascript/styles/mastodon/forms.scss b/app/javascript/styles/mastodon/forms.scss index 3305d1c3cd0..4afd9abaa51 100644 --- a/app/javascript/styles/mastodon/forms.scss +++ b/app/javascript/styles/mastodon/forms.scss @@ -1462,3 +1462,16 @@ code { } } } + +.rules-container { + border: 1px solid var(--color-border-primary); + border-radius: 8px; + height: 200px; + padding: 8px; + overflow-y: scroll; + margin-bottom: 30px; + + .rules-list { + margin-bottom: 0; + } +} diff --git a/app/views/auth/confirmations/captcha.html.haml b/app/views/auth/confirmations/captcha.html.haml index 244948771ff..1a829ef40ec 100644 --- a/app/views/auth/confirmations/captcha.html.haml +++ b/app/views/auth/confirmations/captcha.html.haml @@ -2,8 +2,6 @@ = t('auth.captcha_confirmation.title') = form_with url: auth_captcha_confirmation_url, class: :simple_form do |form| - = render 'auth/shared/progress', stage: 'confirm' - = form.hidden_field :confirmation_token, value: params[:confirmation_token] = form.hidden_field :redirect_to_app, diff --git a/app/views/auth/confirmations/new.html.haml b/app/views/auth/confirmations/new.html.haml index eaa9d9add09..9e347aad72f 100644 --- a/app/views/auth/confirmations/new.html.haml +++ b/app/views/auth/confirmations/new.html.haml @@ -3,8 +3,6 @@ - if resource.errors.of_kind?(:email, :already_confirmed) .simple_form - = render 'auth/shared/progress', stage: resource.approved? ? 'completed' : 'confirmed' - - if resource.approved? %h1.title= t('auth.confirmations.welcome_title', name: resource.account.username) %p.lead= t('auth.confirmations.registration_complete', domain: site_hostname) diff --git a/app/views/auth/registrations/new.html.haml b/app/views/auth/registrations/new.html.haml index 0dc1d894ec7..338dc99a9ee 100644 --- a/app/views/auth/registrations/new.html.haml +++ b/app/views/auth/registrations/new.html.haml @@ -5,8 +5,6 @@ = render partial: 'shared/og', locals: { description: description_for_sign_up(@invite) } = simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { novalidate: false }) do |f| - = render 'auth/shared/progress', stage: 'details' - %h1.title= t('auth.sign_up.title', domain: site_hostname) %p.lead= t('auth.sign_up.preamble') @@ -20,7 +18,6 @@ .fields-group = f.simple_fields_for :account do |ff| = ff.input :username, - append: "@#{site_hostname}", input_html: { autocomplete: 'off', pattern: '[a-zA-Z0-9_]+', maxlength: Account::USERNAME_LENGTH_LIMIT, placeholder: ' ' }, required: true, wrapper: :with_label @@ -76,6 +73,12 @@ = hidden_field_tag :accept, params[:accept] = f.input :invite_code, as: :hidden + %p.lead= t('auth.sign_up.rules') + + .rules-container + %ol.rules-list + = render collection: @rule_translations, partial: 'auth/rule_translations/rule_translation' + .fields-group = f.input :agreement, as: :boolean, diff --git a/app/views/auth/registrations/rules.html.haml b/app/views/auth/registrations/rules.html.haml deleted file mode 100644 index 1e3d934c375..00000000000 --- a/app/views/auth/registrations/rules.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -- content_for :page_title do - = t('auth.register') - -- content_for :header_tags do - = render partial: 'shared/og', locals: { description: description_for_sign_up(@invite) } - -.simple_form - = render 'auth/shared/progress', stage: 'rules' - - - if @invite.present? && @invite.autofollow? - %h1.title= t('auth.rules.title_invited') - %p.lead.invited-by= t('auth.rules.invited_by', domain: site_hostname) - = render 'application/card', account: @invite.user.account, compact: true - %p.lead= t('auth.rules.preamble_invited', domain: site_hostname) - - else - %h1.title= t('auth.rules.title') - %p.lead= t('auth.rules.preamble', domain: site_hostname) - - %ol.rules-list - = render collection: @rule_translations, partial: 'auth/rule_translations/rule_translation' - - .stacked-actions - - accept_path = @invite_code.present? ? public_invite_url(invite_code: @invite_code, accept: @accept_token) : new_user_registration_path(accept: @accept_token) - = link_to t('auth.rules.accept'), accept_path, class: 'button' - = link_to t('auth.rules.back'), root_path, class: 'button button-secondary' diff --git a/app/views/auth/rule_translations/_rule_translation.html.haml b/app/views/auth/rule_translations/_rule_translation.html.haml index 32b9cc28af1..6786607edb3 100644 --- a/app/views/auth/rule_translations/_rule_translation.html.haml +++ b/app/views/auth/rule_translations/_rule_translation.html.haml @@ -1,4 +1,3 @@ %li - %button{ type: 'button', aria: { expanded: 'false' } } - .rules-list__text= rule_translation.text - .rules-list__hint= rule_translation.hint + .rules-list__text= rule_translation.text + .rules-list__hint= rule_translation.hint diff --git a/app/views/auth/setup/show.html.haml b/app/views/auth/setup/show.html.haml index 83e0bfd25f9..c8d395322f7 100644 --- a/app/views/auth/setup/show.html.haml +++ b/app/views/auth/setup/show.html.haml @@ -4,8 +4,6 @@ = vite_typescript_tag 'sign_up.ts', crossorigin: 'anonymous' = simple_form_for(@user, url: auth_setup_path) do |f| - = render 'auth/shared/progress', stage: 'confirm' - %h1.title= t('auth.setup.title') %p.lead= t('auth.setup.email_settings_hint_html', email: content_tag(:strong, @user.email)) diff --git a/app/views/auth/shared/_progress.html.haml b/app/views/auth/shared/_progress.html.haml index 8fb33854194..646548b0558 100644 --- a/app/views/auth/shared/_progress.html.haml +++ b/app/views/auth/shared/_progress.html.haml @@ -1,12 +1,6 @@ -- progress_index = { rules: 0, details: 1, confirm: 2, confirmed: 3, completed: 4 }[stage.to_sym] +- progress_index = { details: 1, confirm: 2, confirmed: 3, completed: 4 }[stage.to_sym] %ol.progress-tracker - %li{ class: progress_index.positive? ? 'completed' : 'active' } - .circle - - if progress_index.positive? - = check_icon - .label= t('auth.progress.rules') - %li.separator{ class: progress_index.positive? ? 'completed' : nil } %li{ class: [progress_index > 1 && 'completed', progress_index == 1 && 'active'] } .circle - if progress_index > 1 diff --git a/config/locales/en.yml b/config/locales/en.yml index aeb0051a112..7ab7332bb1a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1310,6 +1310,7 @@ en: sign_up: manual_review: Sign-ups on %{domain} go through manual review by our moderators. To help us process your registration, write a bit about yourself and why you want an account on %{domain}. preamble: With an account on this Mastodon server, you'll be able to follow any other person on the fediverse, regardless of where their account is hosted. + rules: 'Please mind the rules of this server:' title: Let's get you set up on %{domain}. status: account_status: Account status