mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-23 08:34:13 -05:00
Move redirect/base body class to view (#31796)
This commit is contained in:
parent
8cdc148167
commit
4aa600387e
@ -4,7 +4,6 @@ class Redirect::BaseController < ApplicationController
|
|||||||
vary_by 'Accept-Language'
|
vary_by 'Accept-Language'
|
||||||
|
|
||||||
before_action :set_resource
|
before_action :set_resource
|
||||||
before_action :set_app_body_class
|
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@redirect_path = ActivityPub::TagManager.instance.url_for(@resource)
|
@redirect_path = ActivityPub::TagManager.instance.url_for(@resource)
|
||||||
@ -14,10 +13,6 @@ class Redirect::BaseController < ApplicationController
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_app_body_class
|
|
||||||
@body_classes = 'app-body'
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_resource
|
def set_resource
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
%meta{ name: 'robots', content: 'noindex, noarchive' }/
|
%meta{ name: 'robots', content: 'noindex, noarchive' }/
|
||||||
%link{ rel: 'canonical', href: @redirect_path }
|
%link{ rel: 'canonical', href: @redirect_path }
|
||||||
|
|
||||||
|
- content_for :body_classes, 'app-body'
|
||||||
|
|
||||||
.redirect
|
.redirect
|
||||||
.redirect__logo
|
.redirect__logo
|
||||||
= link_to render_logo, root_path
|
= link_to render_logo, root_path
|
||||||
|
@ -6,27 +6,31 @@ RSpec.describe 'redirection confirmations' do
|
|||||||
let(:account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/foo', url: 'https://example.com/@foo') }
|
let(:account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/foo', url: 'https://example.com/@foo') }
|
||||||
let(:status) { Fabricate(:status, account: account, uri: 'https://example.com/users/foo/statuses/1', url: 'https://example.com/@foo/1') }
|
let(:status) { Fabricate(:status, account: account, uri: 'https://example.com/users/foo/statuses/1', url: 'https://example.com/@foo/1') }
|
||||||
|
|
||||||
context 'when a logged out user visits a local page for a remote account' do
|
context 'when logged out' do
|
||||||
it 'shows a confirmation page' do
|
describe 'a local page for a remote account' do
|
||||||
visit "/@#{account.pretty_acct}"
|
it 'shows a confirmation page with relevant content' do
|
||||||
|
visit "/@#{account.pretty_acct}"
|
||||||
|
|
||||||
# It explains about the redirect
|
expect(page)
|
||||||
expect(page).to have_content(I18n.t('redirects.title', instance: 'cb6e6126.ngrok.io'))
|
.to have_content(redirect_title) # Redirect explanation
|
||||||
|
.and have_link(account.url, href: account.url) # Appropriate account link
|
||||||
|
.and have_css('body', class: 'app-body')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# It features an appropriate link
|
describe 'a local page for a remote status' do
|
||||||
expect(page).to have_link(account.url, href: account.url)
|
it 'shows a confirmation page with relevant content' do
|
||||||
|
visit "/@#{account.pretty_acct}/#{status.id}"
|
||||||
|
|
||||||
|
expect(page)
|
||||||
|
.to have_content(redirect_title) # Redirect explanation
|
||||||
|
.and have_link(status.url, href: status.url) # Appropriate status link
|
||||||
|
.and have_css('body', class: 'app-body')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when a logged out user visits a local page for a remote status' do
|
def redirect_title
|
||||||
it 'shows a confirmation page' do
|
I18n.t('redirects.title', instance: 'cb6e6126.ngrok.io')
|
||||||
visit "/@#{account.pretty_acct}/#{status.id}"
|
|
||||||
|
|
||||||
# It explains about the redirect
|
|
||||||
expect(page).to have_content(I18n.t('redirects.title', instance: 'cb6e6126.ngrok.io'))
|
|
||||||
|
|
||||||
# It features an appropriate link
|
|
||||||
expect(page).to have_link(status.url, href: status.url)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user