Merge remote-tracking branch 'upstream/stable-4.7', removing Mastodon-Modern folder.
This commit is contained in:
commit
8eabb7ea31
959 files changed
+29430
-9565
No files matched your search
@@ -4,7 +4,6 @@ class Api::Fasp::BaseController < ApplicationController
|
||||
class Error < ::StandardError; end
|
||||
|
||||
DIGEST_PATTERN = /sha-256=:(.*?):/
|
||||
KEYID_PATTERN = /keyid="(.*?)"/
|
||||
|
||||
attr_reader :current_provider
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Accounts::BaseController < Api::BaseController
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.without_requested_deletion.find(params[:account_id])
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Accounts::EndorsementsController < Api::BaseController
|
||||
class Api::V1::Accounts::EndorsementsController < Api::V1::Accounts::BaseController
|
||||
include Authorization
|
||||
|
||||
before_action -> { authorize_if_got_token! :read, :'read:accounts' }, only: :index
|
||||
@@ -28,10 +28,6 @@ class Api::V1::Accounts::EndorsementsController < Api::BaseController
|
||||
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
end
|
||||
|
||||
def set_endorsed_accounts
|
||||
@endorsed_accounts = @account.unavailable? ? [] : paginated_endorsed_accounts
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Accounts::FeaturedTagsController < Api::BaseController
|
||||
class Api::V1::Accounts::FeaturedTagsController < Api::V1::Accounts::BaseController
|
||||
before_action :set_account
|
||||
before_action :set_featured_tags
|
||||
|
||||
@@ -12,10 +12,6 @@ class Api::V1::Accounts::FeaturedTagsController < Api::BaseController
|
||||
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
end
|
||||
|
||||
def set_featured_tags
|
||||
@featured_tags = @account.unavailable? ? [] : @account.featured_tags
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Accounts::FollowerAccountsController < Api::BaseController
|
||||
class Api::V1::Accounts::FollowerAccountsController < Api::V1::Accounts::BaseController
|
||||
before_action -> { authorize_if_got_token! :read, :'read:accounts' }
|
||||
before_action :set_account
|
||||
after_action :insert_pagination_headers
|
||||
@@ -13,10 +13,6 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController
|
||||
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
end
|
||||
|
||||
def load_accounts
|
||||
return [] if hide_results?
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Accounts::FollowingAccountsController < Api::BaseController
|
||||
class Api::V1::Accounts::FollowingAccountsController < Api::V1::Accounts::BaseController
|
||||
before_action -> { authorize_if_got_token! :read, :'read:accounts' }
|
||||
before_action :set_account
|
||||
after_action :insert_pagination_headers
|
||||
@@ -13,10 +13,6 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController
|
||||
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
end
|
||||
|
||||
def load_accounts
|
||||
return [] if hide_results?
|
||||
|
||||
|
||||
@@ -6,15 +6,8 @@ class Api::V1::Accounts::IdentityProofsController < Api::BaseController
|
||||
deprecate_api '2022-03-30'
|
||||
|
||||
before_action :require_user!
|
||||
before_action :set_account
|
||||
|
||||
def index
|
||||
render json: []
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Accounts::ListsController < Api::BaseController
|
||||
class Api::V1::Accounts::ListsController < Api::V1::Accounts::BaseController
|
||||
before_action -> { doorkeeper_authorize! :read, :'read:lists' }
|
||||
before_action :require_user!
|
||||
before_action :set_account
|
||||
@@ -9,10 +9,4 @@ class Api::V1::Accounts::ListsController < Api::BaseController
|
||||
@lists = @account.suspended? ? [] : @account.lists.where(account: current_account)
|
||||
render json: @lists, each_serializer: REST::ListSerializer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
end
|
||||
end
|
||||
@@ -13,6 +13,7 @@ class Api::V1::Accounts::LookupController < Api::BaseController
|
||||
|
||||
def set_account
|
||||
@account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound)
|
||||
raise ActiveRecord::RecordNotFound if @account.deleted?
|
||||
rescue Addressable::URI::InvalidURIError
|
||||
raise(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Accounts::NotesController < Api::BaseController
|
||||
class Api::V1::Accounts::NotesController < Api::V1::Accounts::BaseController
|
||||
include Authorization
|
||||
|
||||
before_action -> { doorkeeper_authorize! :write, :'write:accounts' }
|
||||
@@ -20,10 +20,6 @@ class Api::V1::Accounts::NotesController < Api::BaseController
|
||||
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
end
|
||||
|
||||
def relationships_presenter
|
||||
AccountRelationshipsPresenter.new([@account], current_user.account_id)
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class Api::V1::Accounts::RelationshipsController < Api::BaseController
|
||||
before_action :require_user!
|
||||
|
||||
def index
|
||||
@accounts = Account.where(id: account_ids).select(:id, :domain)
|
||||
@accounts = Account.without_requested_deletion.where(id: account_ids).select(:id, :domain)
|
||||
@accounts.merge!(Account.without_suspended) unless truthy_param?(:with_suspended)
|
||||
render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Accounts::StatusesController < Api::BaseController
|
||||
class Api::V1::Accounts::StatusesController < Api::V1::Accounts::BaseController
|
||||
before_action -> { authorize_if_got_token! :read, :'read:statuses' }
|
||||
before_action :set_account
|
||||
|
||||
@@ -14,10 +14,6 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
|
||||
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
end
|
||||
|
||||
def load_statuses
|
||||
@account.unavailable? ? [] : preloaded_account_statuses
|
||||
end
|
||||
|
||||
@@ -84,11 +84,11 @@ class Api::V1::AccountsController < Api::BaseController
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:id])
|
||||
@account = Account.without_requested_deletion.find(params[:id])
|
||||
end
|
||||
|
||||
def set_accounts
|
||||
@accounts = Account.where(id: account_ids).without_unapproved
|
||||
@accounts = Account.where(id: account_ids).without_unapproved.without_requested_deletion
|
||||
end
|
||||
|
||||
def check_account_approval
|
||||
|
||||
@@ -34,7 +34,7 @@ class Api::V1::Admin::IpBlocksController < Api::BaseController
|
||||
|
||||
def update
|
||||
authorize @ip_block, :update?
|
||||
@ip_block.update(resource_params)
|
||||
@ip_block.update!(resource_params)
|
||||
log_action :update, @ip_block
|
||||
render json: @ip_block, serializer: REST::Admin::IpBlockSerializer
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ class Api::V1::CollectionItemsController < Api::BaseController
|
||||
def set_account
|
||||
return render(json: { error: '`account_id` parameter is missing' }, status: 422) if params[:account_id].blank?
|
||||
|
||||
@account = Account.find(params[:account_id])
|
||||
@account = Account.without_requested_deletion.find(params[:account_id])
|
||||
end
|
||||
|
||||
def set_collection_item
|
||||
|
||||
@@ -69,7 +69,7 @@ class Api::V1::CollectionsController < Api::BaseController
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
@account = Account.without_requested_deletion.find(params[:account_id])
|
||||
end
|
||||
|
||||
def set_collections
|
||||
|
||||
@@ -25,7 +25,7 @@ class Api::V1::InCollectionsController < Api::BaseController
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
@account = Account.without_requested_deletion.find(params[:account_id])
|
||||
end
|
||||
|
||||
def set_collections
|
||||
|
||||
Reference in new issue
Block a user