FEATURE: Support searching custom staff actions (#7346)

This commit is contained in:
Roman Rizzi
2019-04-10 09:53:17 -03:00
committed by GitHub
parent 8d5c900142
commit 536b90e0ef
5 changed files with 64 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ class Admin::StaffActionLogsController < Admin::AdminController
staff_action_logs = UserHistory.staff_action_records(current_user, filters).to_a
render json: StaffActionLogsSerializer.new({
staff_action_logs: staff_action_logs,
user_history_actions: UserHistory.staff_actions.sort.map { |name| { id: UserHistory.actions[name], name: name } }
user_history_actions: staff_available_actions
}, root: false)
end
@@ -77,4 +77,14 @@ class Admin::StaffActionLogsController < Admin::AdminController
end
end
private
def staff_available_actions
UserHistory.staff_actions.sort.map do |name|
{
id: name,
action_id: UserHistory.actions[name] || UserHistory.actions[:custom_staff],
}
end
end
end