mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-26 09:08:32 -05:00
33e58c0587
Also refactors post action users to be a new object type since they can have `post_url` which is not a field of a `User`
22 lines
753 B
Ruby
22 lines
753 B
Ruby
require_dependency 'discourse'
|
|
|
|
class PostActionUsersController < ApplicationController
|
|
def index
|
|
params.require(:post_action_type_id)
|
|
params.require(:id)
|
|
post_action_type_id = params[:post_action_type_id].to_i
|
|
|
|
finder = Post.where(id: params[:id].to_i)
|
|
finder = finder.with_deleted if guardian.is_staff?
|
|
|
|
post = finder.first
|
|
guardian.ensure_can_see!(post)
|
|
guardian.ensure_can_see_post_actors!(post.topic, post_action_type_id)
|
|
|
|
post_actions = post.post_actions.where(post_action_type_id: post_action_type_id)
|
|
.includes(:user)
|
|
.order('post_actions.created_at asc')
|
|
|
|
render_serialized(post_actions.to_a, PostActionUserSerializer, root: 'post_action_users')
|
|
end
|
|
end
|