Route account URLs back through AccountsController

This commit is contained in:
Alex Gleason
2019-11-17 20:31:41 -06:00
parent a7955ad491
commit d3ee46c328
3 changed files with 15 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
class AccountsController < ApplicationController
class AccountsController < ReactController
PAGE_SIZE = 20
include AccountControllerConcern
@@ -11,24 +11,7 @@ class AccountsController < ApplicationController
respond_to do |format|
format.html do
mark_cacheable! unless user_signed_in?
@body_classes = 'with-modals'
@pinned_statuses = []
@endorsed_accounts = @account.endorsed_accounts.to_a.sample(4)
if current_account && @account.blocking?(current_account)
@statuses = []
return
end
@pinned_statuses = cache_collection(@account.pinned_statuses, Status) if show_pinned_statuses?
@statuses = filtered_status_page(params)
@statuses = cache_collection(@statuses, Status)
unless @statuses.empty?
@older_url = older_url if @statuses.last.id > filtered_statuses.last.id
@newer_url = newer_url if @statuses.first.id < filtered_statuses.first.id
end
return process(:react)
end
format.atom do

View File

@@ -6,8 +6,6 @@ module AccountControllerConcern
FOLLOW_PER_PAGE = 12
included do
layout 'public'
before_action :set_account
before_action :check_account_approval
before_action :check_account_suspension
@@ -18,7 +16,7 @@ module AccountControllerConcern
private
def set_account
@account = Account.find_local!(username_param)
@account = Account.find_acct!(username_param)
end
def set_instance_presenter
@@ -26,6 +24,8 @@ module AccountControllerConcern
end
def set_link_headers
return if !@account.local? # TODO: Handle remote users
response.headers['Link'] = LinkHeader.new(
[
webfinger_account_link,