2024-02-25 12:15:55 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2011-10-15 02:27:19 -04:00
|
|
|
class ModActionsController < ApplicationController
|
2023-05-07 09:16:48 -04:00
|
|
|
respond_to :html, :json
|
2016-10-16 09:06:08 -04:00
|
|
|
|
2011-10-15 02:27:19 -04:00
|
|
|
def index
|
2019-04-13 02:43:28 -04:00
|
|
|
@mod_actions = ModActionDecorator.decorate_collection(
|
2025-01-12 22:28:32 -05:00
|
|
|
ModAction.visible(CurrentUser.user).includes(:creator).search(search_params).paginate(params[:page], limit: params[:limit]),
|
2019-04-13 02:43:28 -04:00
|
|
|
)
|
2025-01-12 22:28:32 -05:00
|
|
|
respond_with(@mod_actions)
|
2011-10-15 02:27:19 -04:00
|
|
|
end
|
2018-10-26 00:00:43 -04:00
|
|
|
|
|
|
|
def show
|
|
|
|
@mod_action = ModAction.find(params[:id])
|
2025-01-12 22:28:32 -05:00
|
|
|
check_permission(@mod_action)
|
2018-10-26 00:00:43 -04:00
|
|
|
respond_with(@mod_action) do |fmt|
|
2023-05-07 09:16:48 -04:00
|
|
|
fmt.html { redirect_to mod_actions_path(search: { id: @mod_action.id }) }
|
2018-10-26 00:00:43 -04:00
|
|
|
end
|
|
|
|
end
|
2025-01-12 22:28:32 -05:00
|
|
|
|
|
|
|
def check_permission(mod_action)
|
|
|
|
raise(User::PrivilegeError) unless mod_action.can_view?(CurrentUser.user)
|
|
|
|
end
|
2011-10-15 02:27:19 -04:00
|
|
|
end
|