Users can see their pending posts

This commit is contained in:
Robin Ward
2015-04-21 14:36:46 -04:00
parent 26693c16ac
commit 5bf8c31af4
17 changed files with 225 additions and 101 deletions

View File

@@ -8,16 +8,23 @@ class UserActionsController < ApplicationController
user = fetch_user_from_params
opts = {
user_id: user.id,
offset: params[:offset].to_i,
limit: per_chunk,
action_types: (params[:filter] || "").split(",").map(&:to_i),
guardian: guardian,
ignore_private_messages: params[:filter] ? false : true
}
opts = { user_id: user.id,
user: user,
offset: params[:offset].to_i,
limit: per_chunk,
action_types: (params[:filter] || "").split(",").map(&:to_i),
guardian: guardian,
ignore_private_messages: params[:filter] ? false : true }
render_serialized(UserAction.stream(opts), UserActionSerializer, root: "user_actions")
# Pending is restricted
stream = if opts[:action_types].include?(UserAction::PENDING)
guardian.ensure_can_see_notifications!(user)
UserAction.stream_queued(opts)
else
UserAction.stream(opts)
end
render_serialized(stream, UserActionSerializer, root: "user_actions")
end
def show