Route status URLs back through StatusesController
This commit is contained in:
parent
d3ee46c328
commit
b3bdddf374
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class StatusesController < ApplicationController
|
||||
class StatusesController < ReactController
|
||||
include SignatureAuthentication
|
||||
include Authorization
|
||||
|
||||
|
@ -8,8 +8,6 @@ class StatusesController < ApplicationController
|
|||
DESCENDANTS_LIMIT = 60
|
||||
DESCENDANTS_DEPTH_LIMIT = 20
|
||||
|
||||
layout 'public'
|
||||
|
||||
before_action :set_account
|
||||
before_action :set_status
|
||||
before_action :set_instance_presenter
|
||||
|
@ -32,12 +30,7 @@ class StatusesController < ApplicationController
|
|||
expires_in 10.seconds, public: true
|
||||
end
|
||||
|
||||
@body_classes = 'with-modals'
|
||||
|
||||
set_ancestors
|
||||
set_descendants
|
||||
|
||||
render 'stream_entries/show'
|
||||
return process(:react)
|
||||
end
|
||||
|
||||
format.json do
|
||||
|
@ -111,7 +104,7 @@ class StatusesController < ApplicationController
|
|||
end
|
||||
|
||||
def set_account
|
||||
@account = Account.find_local!(params[:account_username])
|
||||
@account = Account.find_acct!(params[:account_username])
|
||||
end
|
||||
|
||||
def set_ancestors
|
||||
|
@ -174,6 +167,8 @@ class StatusesController < ApplicationController
|
|||
end
|
||||
|
||||
def set_link_headers
|
||||
return if !@account.local? # TODO: Handle remote accounts
|
||||
|
||||
response.headers['Link'] = LinkHeader.new(
|
||||
[
|
||||
[account_stream_entry_url(@account, @status.stream_entry, format: 'atom'), [%w(rel alternate), %w(type application/atom+xml)]],
|
||||
|
@ -185,7 +180,7 @@ class StatusesController < ApplicationController
|
|||
def set_status
|
||||
@status = @account.statuses.find(params[:id])
|
||||
@stream_entry = @status.stream_entry
|
||||
@type = @stream_entry.activity_type.downcase
|
||||
@type = @stream_entry&.activity_type&.downcase
|
||||
|
||||
authorize @status, :show?
|
||||
rescue GabSocial::NotPermittedError
|
||||
|
|
|
@ -46,6 +46,7 @@ Rails.application.routes.draw do
|
|||
get '/users/:username', to: redirect('/%{username}'), constraints: html_only
|
||||
get '/users/:username/followers', to: redirect('/%{username}/followers'), constraints: html_only
|
||||
get '/users/:username/following', to: redirect('/%{username}/following'), constraints: html_only
|
||||
get '/users/:username/statuses/:id', to: redirect('/%{username}/posts/%{id}'), constraints: html_only
|
||||
|
||||
get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }
|
||||
|
||||
|
@ -462,8 +463,8 @@ Rails.application.routes.draw do
|
|||
get '/:username/with_replies', to: 'accounts#show', as: :short_account_with_replies
|
||||
get '/:username/media', to: 'accounts#show', as: :short_account_media
|
||||
get '/:username/tagged/:tag', to: 'accounts#show', as: :short_account_tag
|
||||
get '/:username/posts/:statusId/reblogs', to: 'react#react'
|
||||
get '/:account_username/posts/:id', to: 'react#react', as: :short_account_status
|
||||
get '/:username/posts/:statusId/reblogs', to: 'statuses#show'
|
||||
get '/:account_username/posts/:id', to: 'statuses#show', as: :short_account_status
|
||||
get '/:account_username/posts/:id/embed', to: 'statuses#embed', as: :embed_short_account_status
|
||||
|
||||
get '/(*any)', to: 'react#react', as: :web
|
||||
|
|
Loading…
Reference in New Issue