Merge branch 'master' into glitch-soc/merge-upstream

Conflicts:
	app/controllers/api/v1/mutes_controller.rb
	config/locales/simple_form.pl.yml
This commit is contained in:
Thibaut Girka
2018-08-27 17:30:42 +02:00
83 changed files with 900 additions and 120 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class Api::V1::Lists::AccountsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:lists' }, only: [:show]
before_action -> { doorkeeper_authorize! :read, :'read:lists' }, only: [:show]
before_action -> { doorkeeper_authorize! :write, :'write:lists' }, except: [:show]
before_action :require_user!

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class Api::V1::ListsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:lists' }, only: [:index, :show]
before_action -> { doorkeeper_authorize! :read, :'read:lists' }, only: [:index, :show]
before_action -> { doorkeeper_authorize! :write, :'write:lists' }, except: [:index, :show]
before_action :require_user!

View File

@ -20,11 +20,7 @@ class Api::V1::MutesController < Api::BaseController
private
def load_accounts
default_accounts.merge(paginated_mutes).to_a
end
def default_accounts
Account.includes(:muted_by).references(:muted_by)
paginated_mutes.map(&:target_account)
end
def load_mutes
@ -32,11 +28,13 @@ class Api::V1::MutesController < Api::BaseController
end
def paginated_mutes
Mute.where(account: current_account).paginate_by_max_id(
limit_param(DEFAULT_ACCOUNTS_LIMIT),
params[:max_id],
params[:since_id]
)
@paginated_mutes ||= Mute.eager_load(:target_account)
.where(account: current_account)
.paginate_by_max_id(
limit_param(DEFAULT_ACCOUNTS_LIMIT),
params[:max_id],
params[:since_id]
)
end
def insert_pagination_headers
@ -50,7 +48,7 @@ class Api::V1::MutesController < Api::BaseController
end
def prev_path
unless@data.empty?
unless @data.empty?
url_for pagination_params(since_id: pagination_since_id)
end
end
@ -59,7 +57,7 @@ class Api::V1::MutesController < Api::BaseController
if params[:action] == "details"
@mutes.last.id
else
@accounts.last.muted_by_ids.last
paginated_mutes.last.id
end
end
@ -67,7 +65,7 @@ class Api::V1::MutesController < Api::BaseController
if params[:action] == "details"
@mutes.first.id
else
@accounts.first.muted_by_ids.first
paginated_mutes.first.id
end
end