Remove previous landing page (#19300)
This commit is contained in:
		| @@ -5,16 +5,13 @@ class AboutController < ApplicationController | ||||
|  | ||||
|   layout 'public' | ||||
|  | ||||
|   before_action :require_open_federation!, only: [:show, :more] | ||||
|   before_action :require_open_federation!, only: [:more] | ||||
|   before_action :set_body_classes, only: :show | ||||
|   before_action :set_instance_presenter | ||||
|   before_action :set_expires_in, only: [:more] | ||||
|   before_action :set_registration_form_time, only: :show | ||||
|  | ||||
|   skip_before_action :require_functional!, only: [:more] | ||||
|  | ||||
|   def show; end | ||||
|  | ||||
|   def more | ||||
|     flash.now[:notice] = I18n.t('about.instance_actor_flash') if params[:instance_actor] | ||||
|  | ||||
|   | ||||
| @@ -1,10 +0,0 @@ | ||||
| .simple_form | ||||
|   %p.lead= t('about.logged_in_as_html', username: content_tag(:strong, current_account.username)) | ||||
|  | ||||
|   .actions | ||||
|     = link_to t('about.continue_to_web'), root_url, class: 'button button-primary' | ||||
|  | ||||
| .form-footer | ||||
|   %ul.no-list | ||||
|     %li= link_to t('about.get_apps'), 'https://joinmastodon.org/apps', target: '_blank', rel: 'noopener noreferrer' | ||||
|     %li= link_to t('auth.logout'), destroy_user_session_path, data: { method: :delete } | ||||
| @@ -1,22 +0,0 @@ | ||||
| - unless omniauth_only? | ||||
|   = simple_form_for(new_user, url: user_session_path, namespace: 'login') do |f| | ||||
|     .fields-group | ||||
|       - if use_seamless_external_login? | ||||
|         = f.input :email, placeholder: t('simple_form.labels.defaults.username_or_email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.username_or_email') }, hint: false | ||||
|       - else | ||||
|         = f.input :email, placeholder: t('simple_form.labels.defaults.email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }, hint: false | ||||
|  | ||||
|       = f.input :password, placeholder: t('simple_form.labels.defaults.password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }, hint: false | ||||
|  | ||||
|     .actions | ||||
|       = f.button :button, t('auth.login'), type: :submit, class: 'button button-primary' | ||||
|  | ||||
|     %p.hint.subtle-hint= link_to t('auth.trouble_logging_in'), new_user_password_path | ||||
|  | ||||
| - if Devise.mappings[:user].omniauthable? and User.omniauth_providers.any? | ||||
|   .simple_form.alternative-login | ||||
|     %h4= omniauth_only? ? t('auth.log_in_with') : t('auth.or_log_in_with') | ||||
|  | ||||
|     .actions | ||||
|       - User.omniauth_providers.each do |provider| | ||||
|         = provider_sign_in_link(provider) | ||||
| @@ -1,37 +0,0 @@ | ||||
| - disabled = closed_registrations? || omniauth_only? || current_account.present? | ||||
| - show_message = disabled && (current_user.present? || @instance_presenter.closed_registrations_message.present?) | ||||
|  | ||||
| .simple_form__overlay-area{ class: show_message ? 'simple_form__overlay-area__blurred' : '' } | ||||
|   = simple_form_for(new_user, url: user_registration_path, namespace: 'registration', html: { novalidate: false }) do |f| | ||||
|     %p.lead= t('about.federation_hint_html', instance: content_tag(:strong, site_hostname)) | ||||
|  | ||||
|     .fields-group | ||||
|       = f.simple_fields_for :account do |account_fields| | ||||
|         = account_fields.input :username, wrapper: :with_label, label: false, required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username'), :autocomplete => 'off', placeholder: t('simple_form.labels.defaults.username'), pattern: '[a-zA-Z0-9_]+', maxlength: 30 }, append: "@#{site_hostname}", hint: false, disabled: disabled | ||||
|  | ||||
|       = f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email'), :autocomplete => 'off' }, hint: false, disabled: disabled | ||||
|       = f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'new-password', :minlength => User.password_length.first, :maxlength => User.password_length.last }, hint: false, disabled: disabled | ||||
|       = f.input :password_confirmation, placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password'), :autocomplete => 'new-password' }, hint: false, disabled: disabled | ||||
|  | ||||
|       = f.input :confirm_password, as: :string, placeholder: t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')), required: false, input_html: { 'aria-label' => t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')), :autocomplete => 'off' }, hint: false, disabled: disabled | ||||
|       = f.input :website, as: :url, placeholder: t('simple_form.labels.defaults.honeypot', label: 'Website'), required: false, input_html: { 'aria-label' => t('simple_form.labels.defaults.honeypot', label: 'Website'), :autocomplete => 'off' }, hint: false, disabled: disabled | ||||
|  | ||||
|     - if approved_registrations? | ||||
|       .fields-group | ||||
|         = f.simple_fields_for :invite_request do |invite_request_fields| | ||||
|           = invite_request_fields.input :text, as: :text, wrapper: :with_block_label, required: Setting.require_invite_text | ||||
|  | ||||
|     .fields-group | ||||
|       = f.input :agreement, as: :boolean, wrapper: :with_label, label: t('auth.checkbox_agreement_html', rules_path: about_more_path, terms_path: terms_path), required: true, disabled: disabled | ||||
|  | ||||
|     .actions | ||||
|       = f.button :button, sign_up_message, type: :submit, class: 'button button-primary', disabled: disabled | ||||
|  | ||||
|   - if show_message | ||||
|     .simple_form__overlay-area__overlay | ||||
|       .simple_form__overlay-area__overlay__content.rich-formatting | ||||
|         .block-icon= fa_icon 'warning' | ||||
|         - if current_account.present? | ||||
|           = t('about.logout_before_registering') | ||||
|         - else | ||||
|           = @instance_presenter.closed_registrations_message.html_safe | ||||
| @@ -1,69 +0,0 @@ | ||||
| - content_for :page_title do | ||||
|   = site_hostname | ||||
|  | ||||
| - content_for :header_tags do | ||||
|   %link{ rel: 'canonical', href: about_url }/ | ||||
|   = render partial: 'shared/og' | ||||
|  | ||||
| .landing | ||||
|   .landing__brand | ||||
|     = link_to root_url, class: 'brand' do | ||||
|       = logo_as_symbol(:wordmark) | ||||
|       %span.brand__tagline=t 'about.tagline' | ||||
|  | ||||
|   .landing__grid | ||||
|     .landing__grid__column.landing__grid__column-registration | ||||
|       .box-widget | ||||
|         = render 'registration' | ||||
|  | ||||
|       .directory | ||||
|         .directory__tag | ||||
|           = link_to web_path do | ||||
|             %h4 | ||||
|               = fa_icon 'globe fw' | ||||
|               = t('about.see_whats_happening') | ||||
|               %small= t('about.browse_public_posts') | ||||
|  | ||||
|         .directory__tag | ||||
|           = link_to 'https://joinmastodon.org/apps', target: '_blank', rel: 'noopener noreferrer' do | ||||
|             %h4 | ||||
|               = fa_icon 'tablet fw' | ||||
|               = t('about.get_apps') | ||||
|               %small= t('about.apps_platforms') | ||||
|  | ||||
|     .landing__grid__column.landing__grid__column-login | ||||
|       .box-widget | ||||
|         - if current_user.present? | ||||
|           = render 'logged_in' | ||||
|         - else | ||||
|           = render 'login' | ||||
|  | ||||
|       .hero-widget | ||||
|         .hero-widget__img | ||||
|           = image_tag @instance_presenter.hero&.file&.url || @instance_presenter.thumbnail&.file&.url || asset_pack_path('media/images/preview.png'), alt: @instance_presenter.title | ||||
|  | ||||
|         .hero-widget__text | ||||
|           %p | ||||
|             = @instance_presenter.description.html_safe.presence || t('about.about_mastodon_html') | ||||
|             = link_to about_more_path do | ||||
|               = t('about.learn_more') | ||||
|               = fa_icon 'angle-double-right' | ||||
|  | ||||
|         .hero-widget__footer | ||||
|           .hero-widget__footer__column | ||||
|             %h4= t 'about.administered_by' | ||||
|  | ||||
|             = account_link_to @instance_presenter.contact.account | ||||
|  | ||||
|           .hero-widget__footer__column | ||||
|             %h4= t 'about.server_stats' | ||||
|  | ||||
|             .hero-widget__counters__wrapper | ||||
|               .hero-widget__counter | ||||
|                 %strong= friendly_number_to_human @instance_presenter.user_count | ||||
|                 %span= t 'about.user_count_after', count: @instance_presenter.user_count | ||||
|               .hero-widget__counter | ||||
|                 %strong= friendly_number_to_human @instance_presenter.active_user_count | ||||
|                 %span | ||||
|                   = t 'about.active_count_after' | ||||
|                   %abbr{ title: t('about.active_footnote') } * | ||||
| @@ -3,38 +3,25 @@ en: | ||||
|   about: | ||||
|     about_mastodon_html: 'The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!' | ||||
|     about_this: About | ||||
|     active_count_after: active | ||||
|     active_footnote: Monthly Active Users (MAU) | ||||
|     administered_by: 'Administered by:' | ||||
|     api: API | ||||
|     apps: Mobile apps | ||||
|     apps_platforms: Use Mastodon from iOS, Android and other platforms | ||||
|     browse_public_posts: Browse a live stream of public posts on Mastodon | ||||
|     contact: Contact | ||||
|     contact_missing: Not set | ||||
|     contact_unavailable: N/A | ||||
|     continue_to_web: Continue to web app | ||||
|     documentation: Documentation | ||||
|     federation_hint_html: With an account on %{instance} you'll be able to follow people on any Mastodon server and beyond. | ||||
|     get_apps: Try a mobile app | ||||
|     hosted_on: Mastodon hosted on %{domain} | ||||
|     instance_actor_flash: | | ||||
|       This account is a virtual actor used to represent the server itself and not any individual user. | ||||
|       It is used for federation purposes and should not be blocked unless you want to block the whole instance, in which case you should use a domain block. | ||||
|     learn_more: Learn more | ||||
|     logged_in_as_html: You are currently logged in as %{username}. | ||||
|     logout_before_registering: You are already logged in. | ||||
|     privacy_policy: Privacy Policy | ||||
|     rules: Server rules | ||||
|     rules_html: 'Below is a summary of rules you need to follow if you want to have an account on this server of Mastodon:' | ||||
|     see_whats_happening: See what's happening | ||||
|     server_stats: 'Server stats:' | ||||
|     source_code: Source code | ||||
|     status_count_after: | ||||
|       one: post | ||||
|       other: posts | ||||
|     status_count_before: Who published | ||||
|     tagline: Decentralized social network | ||||
|     unavailable_content: Moderated servers | ||||
|     unavailable_content_description: | ||||
|       domain: Server | ||||
| @@ -1049,7 +1036,6 @@ en: | ||||
|       redirecting_to: Your account is inactive because it is currently redirecting to %{acct}. | ||||
|       view_strikes: View past strikes against your account | ||||
|     too_fast: Form submitted too fast, try again. | ||||
|     trouble_logging_in: Trouble logging in? | ||||
|     use_security_key: Use security key | ||||
|   authorize_follow: | ||||
|     already_following: You are already following this account | ||||
|   | ||||
| @@ -641,7 +641,7 @@ Rails.application.routes.draw do | ||||
|  | ||||
|   get '/web/(*any)', to: 'home#index', as: :web | ||||
|  | ||||
|   get '/about',        to: 'about#show' | ||||
|   get '/about',        to: redirect('/') | ||||
|   get '/about/more',   to: 'about#more' | ||||
|  | ||||
|   get '/privacy-policy', to: 'privacy#show', as: :privacy_policy | ||||
|   | ||||
| @@ -3,20 +3,6 @@ require 'rails_helper' | ||||
| RSpec.describe AboutController, type: :controller do | ||||
|   render_views | ||||
|  | ||||
|   describe 'GET #show' do | ||||
|     before do | ||||
|       get :show | ||||
|     end | ||||
|  | ||||
|     it 'assigns @instance_presenter' do | ||||
|       expect(assigns(:instance_presenter)).to be_kind_of InstancePresenter | ||||
|     end | ||||
|  | ||||
|     it 'returns http success' do | ||||
|       expect(response).to have_http_status(200) | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   describe 'GET #more' do | ||||
|     before do | ||||
|       get :more | ||||
| @@ -30,12 +16,4 @@ RSpec.describe AboutController, type: :controller do | ||||
|       expect(response).to have_http_status(200) | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   describe 'helper_method :new_user' do | ||||
|     it 'returns a new User' do | ||||
|       user = @controller.view_context.new_user | ||||
|       expect(user).to be_kind_of User | ||||
|       expect(user.account).to be_kind_of Account | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -10,30 +10,30 @@ describe 'Localization' do | ||||
|   it 'uses a specific region when provided' do | ||||
|     headers = { 'Accept-Language' => 'zh-HK' } | ||||
|  | ||||
|     get "/about", headers: headers | ||||
|     get "/auth/sign_in", headers: headers | ||||
|  | ||||
|     expect(response.body).to include( | ||||
|       I18n.t('about.tagline', locale: 'zh-HK') | ||||
|       I18n.t('auth.login', locale: 'zh-HK') | ||||
|     ) | ||||
|   end | ||||
|  | ||||
|   it 'falls back to a locale when region missing' do | ||||
|     headers = { 'Accept-Language' => 'es-FAKE' } | ||||
|  | ||||
|     get "/about", headers: headers | ||||
|     get "/auth/sign_in", headers: headers | ||||
|  | ||||
|     expect(response.body).to include( | ||||
|       I18n.t('about.tagline', locale: 'es') | ||||
|       I18n.t('auth.login', locale: 'es') | ||||
|     ) | ||||
|   end | ||||
|  | ||||
|   it 'falls back to english when locale is missing' do | ||||
|     headers = { 'Accept-Language' => '12-FAKE' } | ||||
|  | ||||
|     get "/about", headers: headers | ||||
|     get "/auth/sign_in", headers: headers | ||||
|  | ||||
|     expect(response.body).to include( | ||||
|       I18n.t('about.tagline', locale: 'en') | ||||
|       I18n.t('auth.login', locale: 'en') | ||||
|     ) | ||||
|   end | ||||
| end | ||||
|   | ||||
| @@ -1,25 +0,0 @@ | ||||
| # frozen_string_literal: true | ||||
|  | ||||
| require 'rails_helper' | ||||
|  | ||||
| describe 'about/show.html.haml', without_verify_partial_doubles: true do | ||||
|   before do | ||||
|     allow(view).to receive(:site_hostname).and_return('example.com') | ||||
|     allow(view).to receive(:site_title).and_return('example site') | ||||
|     allow(view).to receive(:new_user).and_return(User.new) | ||||
|     allow(view).to receive(:use_seamless_external_login?).and_return(false) | ||||
|     allow(view).to receive(:current_account).and_return(nil) | ||||
|   end | ||||
|  | ||||
|   it 'has valid open graph tags' do | ||||
|     assign(:instance_presenter, InstancePresenter.new) | ||||
|     render | ||||
|  | ||||
|     header_tags = view.content_for(:header_tags) | ||||
|  | ||||
|     expect(header_tags).to match(%r{<meta content=".+" property="og:title" />}) | ||||
|     expect(header_tags).to match(%r{<meta content="website" property="og:type" />}) | ||||
|     expect(header_tags).to match(%r{<meta content=".+" property="og:image" />}) | ||||
|     expect(header_tags).to match(%r{<meta content="http://.+" property="og:url" />}) | ||||
|   end | ||||
| end | ||||
		Reference in New Issue
	
	Block a user