mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
FEATURE: Display pending posts on user’s page
Currently when a user creates posts that are moderated (for whatever reason), a popup is displayed saying the post needs approval and the total number of the user’s pending posts. But then this piece of information is kind of lost and there is nowhere for the user to know what are their pending posts or how many there are. This patch solves this issue by adding a new “Pending” section to the user’s activity page when there are some pending posts to display. When there are none, then the “Pending” section isn’t displayed at all.
This commit is contained in:

committed by
Loïc Guitaut

parent
6e603799eb
commit
a5fbb90df4
@ -598,6 +598,14 @@ class PostsController < ApplicationController
|
||||
render_serialized(posts, AdminUserActionSerializer)
|
||||
end
|
||||
|
||||
def pending
|
||||
params.require(:username)
|
||||
user = fetch_user_from_params
|
||||
raise Discourse::NotFound unless guardian.can_edit_user?(user)
|
||||
|
||||
render_serialized(user.pending_posts.order(created_at: :desc), PendingPostSerializer, root: :pending_posts)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# We can't break the API for making posts. The new, queue supporting API
|
||||
|
Reference in New Issue
Block a user