mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FEATURE: Make staff action logs page support infinite loading
This commit is contained in:
@ -216,7 +216,16 @@ class UserHistory < ActiveRecord::Base
|
||||
opts[:action_id] = self.actions[opts[:action_name].to_sym] if opts[:action_name]
|
||||
end
|
||||
|
||||
query = self.with_filters(opts.slice(*staff_filters)).only_staff_actions.limit(200).order('id DESC').includes(:acting_user, :target_user)
|
||||
page = (opts[:page] || 0).to_i
|
||||
page_size = (opts[:limit] || 200).to_i
|
||||
|
||||
query = self
|
||||
.with_filters(opts.slice(*staff_filters))
|
||||
.only_staff_actions
|
||||
.limit(page_size)
|
||||
.offset(page * page_size)
|
||||
.order('id DESC')
|
||||
.includes(:acting_user, :target_user)
|
||||
query = query.where(admin_only: false) unless viewer && viewer.admin?
|
||||
query
|
||||
end
|
||||
|
Reference in New Issue
Block a user