diff --git a/app/assets/javascripts/discourse/models/store.js.es6 b/app/assets/javascripts/discourse/models/store.js.es6 index 61ce9f581c8..f0608b86b0c 100644 --- a/app/assets/javascripts/discourse/models/store.js.es6 +++ b/app/assets/javascripts/discourse/models/store.js.es6 @@ -111,22 +111,32 @@ export default Ember.Object.extend({ return this.container.lookup('adapter:' + type) || this.container.lookup('adapter:rest'); }, + _lookupSubType(subType, id, root) { + + // cheat: we know we already have categories in memory + if (subType === 'category') { + return Discourse.Category.findById(id); + } + + const collection = root[this.pluralize(subType)]; + if (collection) { + const found = collection.findProperty('id', id); + if (found) { + return this._hydrate(subType, found, root); + } + } + }, + _hydrateEmbedded(obj, root) { const self = this; Object.keys(obj).forEach(function(k) { const m = /(.+)\_id$/.exec(k); if (m) { const subType = m[1]; - const collection = root[self.pluralize(subType)]; - if (collection) { - const found = collection.findProperty('id', obj[k]); - if (found) { - const hydrated = self._hydrate(subType, found, root); - if (hydrated) { - obj[subType] = hydrated; - delete obj[k]; - } - } + const hydrated = self._lookupSubType(subType, obj[k], root); + if (hydrated) { + obj[subType] = hydrated; + delete obj[k]; } } }); diff --git a/app/assets/javascripts/discourse/templates/queued-posts.hbs b/app/assets/javascripts/discourse/templates/queued-posts.hbs index e2d096514c2..60fa6dbdd09 100644 --- a/app/assets/javascripts/discourse/templates/queued-posts.hbs +++ b/app/assets/javascripts/discourse/templates/queued-posts.hbs @@ -18,6 +18,7 @@ {{else}} {{post.post_options.title}} {{/if}} + {{category-badge post.category}} {{{cook-text post.raw}}} diff --git a/app/assets/stylesheets/desktop/queued-posts.scss b/app/assets/stylesheets/desktop/queued-posts.scss index 49cdb433de1..19f1bc07371 100644 --- a/app/assets/stylesheets/desktop/queued-posts.scss +++ b/app/assets/stylesheets/desktop/queued-posts.scss @@ -14,6 +14,10 @@ .post-title { color: darken(scale-color-diff(), 50%); font-weight: bold; + + .badge-wrapper { + margin-left: 1em; + } } border-bottom: 1px solid darken(scale-color-diff(), 10%); diff --git a/app/models/user_history.rb b/app/models/user_history.rb index 3fe017d69a1..94f48adecdc 100644 --- a/app/models/user_history.rb +++ b/app/models/user_history.rb @@ -38,7 +38,8 @@ class UserHistory < ActiveRecord::Base :change_username, :custom, :custom_staff, - :anonymize_user) + :anonymize_user, + :reviewed_post) end # Staff actions is a subset of all actions, used to audit actions taken by staff users. @@ -59,7 +60,8 @@ class UserHistory < ActiveRecord::Base :roll_up, :change_username, :custom_staff, - :anonymize_user] + :anonymize_user, + :reviewed_post] end def self.staff_action_ids diff --git a/app/serializers/queued_post_serializer.rb b/app/serializers/queued_post_serializer.rb index 8e2637bce7a..33b0bccf909 100644 --- a/app/serializers/queued_post_serializer.rb +++ b/app/serializers/queued_post_serializer.rb @@ -9,9 +9,19 @@ class QueuedPostSerializer < ApplicationSerializer :rejected_by_id, :raw, :post_options, - :created_at + :created_at, + :category_id has_one :user, serializer: BasicUserSerializer, embed: :object has_one :topic, serializer: BasicTopicSerializer + def category_id + cat_id = object.topic.try(:category_id) || object.post_options['category'] + cat_id.to_i if cat_id + end + + def include_category_id? + category_id.present? + end + end diff --git a/spec/models/queued_post_spec.rb b/spec/models/queued_post_spec.rb index cd8d169d871..c433b5c4c16 100644 --- a/spec/models/queued_post_spec.rb +++ b/spec/models/queued_post_spec.rb @@ -98,7 +98,7 @@ describe QueuedPost do expect(topic.category).to eq(category) end - it "doesn't create the post and topic" do + it "rejecting doesn't create the post and topic" do topic_count, post_count = Topic.count, Post.count qp.reject!(admin)