Skip to content
Snippets Groups Projects
Commit 73540ffe authored by Matt Jankowski's avatar Matt Jankowski Committed by Eugen Rochko
Browse files

Clean up for api/base controller (#3629)

* Move ApiController to Api/BaseController

* API controllers inherit from Api::BaseController

* Add coverage for various error cases in api/base controller
parent 92bb1662
No related branches found
No related tags found
No related merge requests found
Showing
with 20 additions and 20 deletions
# frozen_string_literal: true
class Api::Activitypub::ActivitiesController < ApiController
class Api::Activitypub::ActivitiesController < Api::BaseController
include Authorization
# before_action :set_follow, only: [:show_follow]
......
# frozen_string_literal: true
class Api::Activitypub::NotesController < ApiController
class Api::Activitypub::NotesController < Api::BaseController
include Authorization
before_action :set_status
......
# frozen_string_literal: true
class Api::Activitypub::OutboxController < ApiController
class Api::Activitypub::OutboxController < Api::BaseController
before_action :set_account
respond_to :activitystreams2
......
# frozen_string_literal: true
class ApiController < ApplicationController
class Api::BaseController < ApplicationController
DEFAULT_STATUSES_LIMIT = 20
DEFAULT_ACCOUNTS_LIMIT = 40
......
# frozen_string_literal: true
class Api::OEmbedController < ApiController
class Api::OEmbedController < Api::BaseController
respond_to :json
def show
......
# frozen_string_literal: true
class Api::PushController < ApiController
class Api::PushController < Api::BaseController
def update
response, status = process_push_request
render plain: response, status: status
......
# frozen_string_literal: true
class Api::SalmonController < ApiController
class Api::SalmonController < Api::BaseController
before_action :set_account
respond_to :txt
......
# frozen_string_literal: true
class Api::SubscriptionsController < ApiController
class Api::SubscriptionsController < Api::BaseController
before_action :set_account
respond_to :txt
......
# frozen_string_literal: true
class Api::V1::Accounts::CredentialsController < ApiController
class Api::V1::Accounts::CredentialsController < Api::BaseController
before_action -> { doorkeeper_authorize! :write }, only: [:update]
before_action :require_user!
......
# frozen_string_literal: true
class Api::V1::Accounts::FollowerAccountsController < ApiController
class Api::V1::Accounts::FollowerAccountsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }
before_action :set_account
after_action :insert_pagination_headers
......
# frozen_string_literal: true
class Api::V1::Accounts::FollowingAccountsController < ApiController
class Api::V1::Accounts::FollowingAccountsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }
before_action :set_account
after_action :insert_pagination_headers
......
# frozen_string_literal: true
class Api::V1::Accounts::RelationshipsController < ApiController
class Api::V1::Accounts::RelationshipsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }
before_action :require_user!
......
# frozen_string_literal: true
class Api::V1::Accounts::SearchController < ApiController
class Api::V1::Accounts::SearchController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }
before_action :require_user!
......
# frozen_string_literal: true
class Api::V1::Accounts::StatusesController < ApiController
class Api::V1::Accounts::StatusesController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }
before_action :set_account
after_action :insert_pagination_headers
......
# frozen_string_literal: true
class Api::V1::AccountsController < ApiController
class Api::V1::AccountsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }, except: [:follow, :unfollow, :block, :unblock, :mute, :unmute]
before_action -> { doorkeeper_authorize! :follow }, only: [:follow, :unfollow, :block, :unblock, :mute, :unmute]
before_action :require_user!, except: [:show]
......
# frozen_string_literal: true
class Api::V1::AppsController < ApiController
class Api::V1::AppsController < Api::BaseController
respond_to :json
def create
......
# frozen_string_literal: true
class Api::V1::BlocksController < ApiController
class Api::V1::BlocksController < Api::BaseController
before_action -> { doorkeeper_authorize! :follow }
before_action :require_user!
after_action :insert_pagination_headers
......
# frozen_string_literal: true
class Api::V1::DomainBlocksController < ApiController
class Api::V1::DomainBlocksController < Api::BaseController
BLOCK_LIMIT = 100
before_action -> { doorkeeper_authorize! :follow }
......
# frozen_string_literal: true
class Api::V1::FavouritesController < ApiController
class Api::V1::FavouritesController < Api::BaseController
before_action -> { doorkeeper_authorize! :read }
before_action :require_user!
after_action :insert_pagination_headers
......
# frozen_string_literal: true
class Api::V1::FollowRequestsController < ApiController
class Api::V1::FollowRequestsController < Api::BaseController
before_action -> { doorkeeper_authorize! :follow }
before_action :require_user!
after_action :insert_pagination_headers, only: :index
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment