mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:29:30 +08:00
a5fbb90df4
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.
28 lines
660 B
Ruby
28 lines
660 B
Ruby
# frozen_string_literal: true
|
|
|
|
class PendingPostSerializer < ApplicationSerializer
|
|
attributes :id,
|
|
:avatar_template,
|
|
:category_id,
|
|
:created_at,
|
|
:created_by_id,
|
|
:name,
|
|
:raw_text,
|
|
:title,
|
|
:topic_id,
|
|
:topic_url,
|
|
:username
|
|
|
|
delegate :created_by, :payload, :topic, to: :object, private: true
|
|
delegate :url, to: :topic, prefix: true, allow_nil: true
|
|
delegate :avatar_template, :name, :username, to: :created_by, allow_nil: true
|
|
|
|
def raw_text
|
|
payload["raw"]
|
|
end
|
|
|
|
def title
|
|
payload["title"] || topic.title
|
|
end
|
|
end
|