Add a /user_actions page. This page shows you a global timeline of (almost) all activity on the site, including uploads, comments, votes, edits, forum posts, and so on. The main things it doesn't include are post edits, pool edits, and favorites (posts and pools live in a separate database, and favorites don't have the timestamps we need for ordering). This page is useful for moderation purposes because it lets you see a history of almost all of a user's activity on a single page. Currently this page is mod-only. In the future it will be open to all users, so you can view the history of your own site activity, or the activity of others.
24 lines
906 B
Ruby
24 lines
906 B
Ruby
# frozen_string_literal: true
|
|
|
|
class UserActionsController < ApplicationController
|
|
respond_to :html, :xml, :json
|
|
|
|
def index
|
|
if user_id = params[:user_id] || params.dig(:search, :user_id)
|
|
@user = User.find(user_id)
|
|
elsif user_name = params.dig(:search, :user_name)
|
|
@user = User.find_by_name(user_name)
|
|
end
|
|
|
|
@user_actions = authorize UserAction.for_user(CurrentUser.user).paginated_search(params, count_pages: @user.present?)
|
|
@user_actions = @user_actions.includes(:user, model: [:artist, :post, :note, :user, :creator, :banner, :bulk_update_request, :tag, :antecedent_tag, :consequent_tag, :model, :topic, :purchaser, :recipient, :forum_topic, forum_post: [:topic], comment: [:creator, :post]]) if request.format.html?
|
|
|
|
respond_with(@user_actions)
|
|
end
|
|
|
|
def show
|
|
@user_actions = authorize UserAction.find(params[:id])
|
|
respond_with(@user_actions)
|
|
end
|
|
end
|