mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-22 14:58:16 +00:00
Fix code style issues
This commit is contained in:
@@ -15,7 +15,7 @@ class Api::V1::MutesController < Api::BaseController
|
|||||||
def details
|
def details
|
||||||
@data = @mutes = load_mutes
|
@data = @mutes = load_mutes
|
||||||
render json: @mutes, each_serializer: REST::MuteSerializer
|
render json: @mutes, each_serializer: REST::MuteSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
@@ -44,19 +44,15 @@ class Api::V1::MutesController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def next_path
|
def next_path
|
||||||
if records_continue?
|
url_for pagination_params(max_id: pagination_max_id) if records_continue?
|
||||||
url_for pagination_params(max_id: pagination_max_id)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def prev_path
|
def prev_path
|
||||||
unless@data.empty?
|
url_for pagination_params(since_id: pagination_since_id) unless @data.empty?
|
||||||
url_for pagination_params(since_id: pagination_since_id)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pagination_max_id
|
def pagination_max_id
|
||||||
if params[:action] == "details"
|
if params[:action] == 'details'
|
||||||
@mutes.last.id
|
@mutes.last.id
|
||||||
else
|
else
|
||||||
@accounts.last.muted_by_ids.last
|
@accounts.last.muted_by_ids.last
|
||||||
@@ -64,7 +60,7 @@ class Api::V1::MutesController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pagination_since_id
|
def pagination_since_id
|
||||||
if params[:action] == "details"
|
if params[:action] == 'details'
|
||||||
@mutes.first.id
|
@mutes.first.id
|
||||||
else
|
else
|
||||||
@accounts.first.muted_by_ids.first
|
@accounts.first.muted_by_ids.first
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module AccountInteractions
|
|||||||
def muting_map(target_account_ids, account_id)
|
def muting_map(target_account_ids, account_id)
|
||||||
Mute.where(target_account_id: target_account_ids, account_id: account_id).each_with_object({}) do |mute, mapping|
|
Mute.where(target_account_id: target_account_ids, account_id: account_id).each_with_object({}) do |mute, mapping|
|
||||||
mapping[mute.target_account_id] = {
|
mapping[mute.target_account_id] = {
|
||||||
notifications: mute.hide_notifications?
|
notifications: mute.hide_notifications?,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class REST::MuteSerializer < ActiveModel::Serializer
|
class REST::MuteSerializer < ActiveModel::Serializer
|
||||||
include RoutingHelper
|
include RoutingHelper
|
||||||
|
|
||||||
attributes :id, :account, :target_account, :created_at, :hide_notifications
|
attributes :id, :account, :target_account, :created_at, :hide_notifications
|
||||||
|
|
||||||
def account
|
def account
|
||||||
@@ -12,4 +12,5 @@ class REST::MuteSerializer < ActiveModel::Serializer
|
|||||||
def target_account
|
def target_account
|
||||||
REST::AccountSerializer.new(object.target_account)
|
REST::AccountSerializer.new(object.target_account)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user