mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 07:46:21 +00:00
feat: recordar el filtro que estábamos usando
This commit is contained in:
parent
259d1c1e90
commit
f9d02cc63e
2 changed files with 12 additions and 11 deletions
|
@ -3,23 +3,18 @@
|
||||||
# Actualiza la relación entre un sitio y una instancia
|
# Actualiza la relación entre un sitio y una instancia
|
||||||
class InstanceModerationsController < ApplicationController
|
class InstanceModerationsController < ApplicationController
|
||||||
before_action :authorize_policy, except: %i[action_on_several]
|
before_action :authorize_policy, except: %i[action_on_several]
|
||||||
|
around_action :redirect_to_moderation_queue!
|
||||||
|
|
||||||
def pause
|
def pause
|
||||||
instance_moderation.pause!
|
instance_moderation.pause! if instance_moderation.may_pause?
|
||||||
|
|
||||||
redirect_to site_moderation_queue_path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def allow
|
def allow
|
||||||
instance_moderation.allow!
|
instance_moderation.allow! if instance_moderation.may_allow?
|
||||||
|
|
||||||
redirect_to site_moderation_queue_path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def block
|
def block
|
||||||
instance_moderation.block!
|
instance_moderation.block! if instance_moderation.may_block?
|
||||||
|
|
||||||
redirect_to site_moderation_queue_path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def action_on_several
|
def action_on_several
|
||||||
|
@ -39,12 +34,16 @@ class InstanceModerationsController < ApplicationController
|
||||||
instance_moderation.public_send(method)
|
instance_moderation.public_send(method)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to site_moderation_queue_path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def redirect_to_moderation_queue!(&action)
|
||||||
|
redirect_back fallback_location: site_moderation_queue_path, state: session[:moderation_queue_filtered_by_state]
|
||||||
|
|
||||||
|
yield
|
||||||
|
end
|
||||||
|
|
||||||
# @return [InstanceModeration]
|
# @return [InstanceModeration]
|
||||||
def instance_moderation
|
def instance_moderation
|
||||||
@instance_moderation ||= site.instance_moderations.find(params[:instance_moderation_id])
|
@instance_moderation ||= site.instance_moderations.find(params[:instance_moderation_id])
|
||||||
|
|
|
@ -6,6 +6,8 @@ class ModerationQueueController < ApplicationController
|
||||||
def index
|
def index
|
||||||
dummy_data
|
dummy_data
|
||||||
|
|
||||||
|
session[:moderation_queue_filtered_by_state] = params[:state]
|
||||||
|
|
||||||
# @todo cambiar el estado por query
|
# @todo cambiar el estado por query
|
||||||
@activity_pubs = site.activity_pubs
|
@activity_pubs = site.activity_pubs
|
||||||
@instance_moderations = rubanok_process(site.instance_moderations, with: InstanceModerationProcessor)
|
@instance_moderations = rubanok_process(site.instance_moderations, with: InstanceModerationProcessor)
|
||||||
|
|
Loading…
Reference in a new issue