forked from treehouse/mastodon
Redirect to account status page for page of status stream entry (#7104)
Commit 519119f657
missed a change for
stream entry page. Instead of duplicating the change, redirect to account
status page. It would also help crawlers (of search engines, for example)
to understand a stream entry URL and its corresponding status URL points
to the same page.
rebase/4.0.0rc2
parent
7c43ed04fe
commit
a1049e9380
|
@ -15,8 +15,7 @@ class StreamEntriesController < ApplicationController
|
||||||
def show
|
def show
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
@ancestors = @stream_entry.activity.reply? ? cache_collection(@stream_entry.activity.ancestors(current_account), Status) : []
|
redirect_to short_account_status_url(params[:account_username], @stream_entry.activity) if @type == 'status'
|
||||||
@descendants = cache_collection(@stream_entry.activity.descendants(current_account), Status)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
format.atom do
|
format.atom do
|
||||||
|
|
|
@ -66,16 +66,12 @@ RSpec.describe StreamEntriesController, type: :controller do
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
include_examples 'before_action', :show
|
include_examples 'before_action', :show
|
||||||
|
|
||||||
it 'renders with HTML' do
|
it 'redirects to status page' do
|
||||||
ancestor = Fabricate(:status)
|
status = Fabricate(:status)
|
||||||
status = Fabricate(:status, in_reply_to_id: ancestor.id)
|
|
||||||
descendant = Fabricate(:status, in_reply_to_id: status.id)
|
|
||||||
|
|
||||||
get :show, params: { account_username: status.account.username, id: status.stream_entry.id }
|
get :show, params: { account_username: status.account.username, id: status.stream_entry.id }
|
||||||
|
|
||||||
expect(assigns(:ancestors)).to eq [ancestor]
|
expect(response).to redirect_to(short_account_status_url(status.account, status))
|
||||||
expect(assigns(:descendants)).to eq [descendant]
|
|
||||||
expect(response).to have_http_status(:success)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success with Atom' do
|
it 'returns http success with Atom' do
|
||||||
|
|
Loading…
Reference in New Issue