diff --git a/app/assets/javascripts/discourse/templates/topic.hbs b/app/assets/javascripts/discourse/templates/topic.hbs
index 65136ab67b..5d65e09000 100644
--- a/app/assets/javascripts/discourse/templates/topic.hbs
+++ b/app/assets/javascripts/discourse/templates/topic.hbs
@@ -89,6 +89,17 @@
{{view 'topic-closing' topic=model}}
{{view 'topic-footer-buttons' topic=model}}
+ {{#if pending_posts_count}}
+
+ {{{i18n "queue.has_pending_posts" count=pending_posts_count}}}
+
+ {{#link-to 'queued-posts'}}
+ {{fa-icon 'check'}}
+ {{i18n 'queue.view_pending'}}
+ {{/link-to}}
+
+ {{/if}}
+
{{plugin-outlet "topic-above-suggested"}}
{{#if details.suggested_topics.length}}
diff --git a/app/assets/stylesheets/common/base/topic.scss b/app/assets/stylesheets/common/base/topic.scss
index 4eb62c3089..443f6cb023 100644
--- a/app/assets/stylesheets/common/base/topic.scss
+++ b/app/assets/stylesheets/common/base/topic.scss
@@ -41,3 +41,11 @@
}
}
+
+.has-pending-posts {
+ padding: 0.5em;
+ background-color: dark-light-diff($highlight, $secondary, 50%, -70%);
+ a[href] {
+ float: right;
+ }
+}
diff --git a/app/models/topic.rb b/app/models/topic.rb
index 16710ed9ad..a61cc81969 100644
--- a/app/models/topic.rb
+++ b/app/models/topic.rb
@@ -85,6 +85,7 @@ class Topic < ActiveRecord::Base
has_many :allowed_group_users, through: :allowed_groups, source: :users
has_many :allowed_groups, through: :topic_allowed_groups, source: :group
has_many :allowed_users, through: :topic_allowed_users, source: :user
+ has_many :queued_posts
has_one :top_topic
belongs_to :user
@@ -271,6 +272,10 @@ class Topic < ActiveRecord::Base
Redcarpet::Render::SmartyPants.render(sanitized_title)
end
+ def pending_posts_count
+ queued_posts.new_count
+ end
+
# Returns hot topics since a date for display in email digest.
def self.for_digest(user, since, opts=nil)
opts = opts || {}
diff --git a/app/serializers/topic_view_serializer.rb b/app/serializers/topic_view_serializer.rb
index eec7b2c447..41d296670b 100644
--- a/app/serializers/topic_view_serializer.rb
+++ b/app/serializers/topic_view_serializer.rb
@@ -1,4 +1,5 @@
require_dependency 'pinned_check'
+require_dependency 'new_post_manager'
class TopicViewSerializer < ApplicationSerializer
include PostStreamSerializerMixin
@@ -30,7 +31,8 @@ class TopicViewSerializer < ApplicationSerializer
:slug,
:category_id,
:word_count,
- :deleted_at
+ :deleted_at,
+ :pending_posts_count
attributes :draft,
:draft_key,
@@ -206,4 +208,8 @@ class TopicViewSerializer < ApplicationSerializer
object.topic_user.try(:bookmarked)
end
+ def include_pending_posts_count
+ scope.user.staff? && NewPostManager.queue_enabled?
+ end
+
end
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index e0ab53a68f..378142c727 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -236,6 +236,11 @@ en:
none: "There are no posts to review."
edit: "Edit"
cancel: "Cancel"
+ view_pending: "view pending posts"
+ has_pending_posts:
+ one: "This topic has 1 post awaiting approval"
+ many: "This topic has {{count}} posts awaiting approval"
+
confirm: "Save Changes"
delete_prompt: "Are you sure you want to delete %{username}? This will remove all of their posts and block their email and ip address."