diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-flagged-post.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-flagged-post.hbs index be4407ffc9c..22b5ceb3857 100644 --- a/app/assets/javascripts/discourse/templates/components/reviewable-flagged-post.hbs +++ b/app/assets/javascripts/discourse/templates/components/reviewable-flagged-post.hbs @@ -12,9 +12,8 @@
{{reviewable-created-by user=reviewable.target_created_by tagName=''}}
- {{reviewable-created-by-name user=reviewable.target_created_by tagName=''}} + {{reviewable-post-header reviewable=reviewable createdBy=reviewable.target_created_by tagName=''}}
- {{#if reviewable.blank_post}}

{{i18n "review.deleted_post"}}

{{else}} diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-post-header.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-post-header.hbs new file mode 100644 index 00000000000..70b7d326735 --- /dev/null +++ b/app/assets/javascripts/discourse/templates/components/reviewable-post-header.hbs @@ -0,0 +1,9 @@ +
+ {{reviewable-created-by-name user=createdBy tagName=''}} + {{#if reviewable.reply_to_post_number}} + + {{d-icon "share"}} + {{i18n "review.in_reply_to"}} + + {{/if}} +
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs index 1a02f4d9627..b5220b84d07 100644 --- a/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs +++ b/app/assets/javascripts/discourse/templates/components/reviewable-queued-post.hbs @@ -10,7 +10,7 @@ {{reviewable-created-by user=reviewable.created_by tagName=''}}
- {{reviewable-created-by-name user=reviewable.created_by tagName=''}} + {{reviewable-post-header reviewable=reviewable createdBy=reviewable.created_by tagName=''}}
{{cook-text reviewable.payload.raw}} diff --git a/app/assets/stylesheets/common/base/reviewables.scss b/app/assets/stylesheets/common/base/reviewables.scss index 8e78aed24fe..ba89457c853 100644 --- a/app/assets/stylesheets/common/base/reviewables.scss +++ b/app/assets/stylesheets/common/base/reviewables.scss @@ -389,6 +389,23 @@ display: flex; } } + .reviewable-post-header { + display: flex; + justify-content: space-between; + max-width: $topic-body-width; + width: $topic-body-width; + align-items: center; + + .reviewable-reply-to { + display: flex; + align-items: center; + color: $primary-medium; + font-size: 0.9em; + .d-icon { + margin-right: 0.5em; + } + } + } .post-contents { width: 100%; diff --git a/app/serializers/reviewable_flagged_post_serializer.rb b/app/serializers/reviewable_flagged_post_serializer.rb index 9a0e28c72e1..797fe3928db 100644 --- a/app/serializers/reviewable_flagged_post_serializer.rb +++ b/app/serializers/reviewable_flagged_post_serializer.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ReviewableFlaggedPostSerializer < ReviewableSerializer - target_attributes :cooked, :raw, :reply_count + target_attributes :cooked, :raw, :reply_count, :reply_to_post_number attributes :blank_post, :post_updated_at, :post_version def post_version diff --git a/app/serializers/reviewable_queued_post_serializer.rb b/app/serializers/reviewable_queued_post_serializer.rb index fa29213ff31..dbc06ac9a6f 100644 --- a/app/serializers/reviewable_queued_post_serializer.rb +++ b/app/serializers/reviewable_queued_post_serializer.rb @@ -2,6 +2,8 @@ class ReviewableQueuedPostSerializer < ReviewableSerializer + attributes :reply_to_post_number + payload_attributes( :raw, :title, @@ -11,11 +13,18 @@ class ReviewableQueuedPostSerializer < ReviewableSerializer :is_warning, :first_post_checks, :featured_link, - :reply_to_post_number, :is_poll, :typing_duration_msecs, :composer_open_duration_msecs, :tags ) + def reply_to_post_number + object.payload['reply_to_post_number'].to_i + end + + def include_reply_to_post_number? + object.payload['reply_to_post_number'].present? + end + end diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 65b7a27f4ef..0a761e5df04 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -363,6 +363,7 @@ en: placeholder: "type the message title here" review: + in_reply_to: "in reply to" claim_help: optional: "You can claim this item to prevent others from reviewing it." required: "You must claim items before you can review them." diff --git a/lib/new_post_manager.rb b/lib/new_post_manager.rb index b03bec874be..ba5e4684019 100644 --- a/lib/new_post_manager.rb +++ b/lib/new_post_manager.rb @@ -194,10 +194,17 @@ class NewPostManager # Enqueue this post def enqueue(reason = nil) result = NewPostResult.new(:enqueued) + payload = { + raw: @args[:raw], + tags: @args[:tags] + } + %w(typing_duration_msecs composer_open_duration_msecs reply_to_post_number).each do |a| + payload[a] = @args[a].to_i if @args[a] + end reviewable = ReviewableQueuedPost.new( created_by: @user, - payload: { raw: @args[:raw], tags: @args[:tags] }, + payload: payload, topic_id: @args[:topic_id], reviewable_by_moderator: true ) diff --git a/spec/requests/posts_controller_spec.rb b/spec/requests/posts_controller_spec.rb index 8044572b684..61880b4254d 100644 --- a/spec/requests/posts_controller_spec.rb +++ b/spec/requests/posts_controller_spec.rb @@ -810,7 +810,10 @@ describe PostsController do it 'queues the post if min_first_post_typing_time is not met' do post "/posts.json", params: { raw: 'this is the test content', - title: 'this is the test title for the topic' + title: 'this is the test title for the topic', + composer_open_duration_msecs: 204, + typing_duration_msecs: 100, + reply_to_post_number: 123 } expect(response.status).to eq(200) @@ -822,6 +825,9 @@ describe PostsController do expect(user).to be_silenced rp = ReviewableQueuedPost.find_by(created_by: user) + expect(rp.payload['typing_duration_msecs']).to eq(100) + expect(rp.payload['composer_open_duration_msecs']).to eq(204) + expect(rp.payload['reply_to_post_number']).to eq(123) expect(rp.reviewable_scores.first.reason).to eq('fast_typer') expect(parsed['pending_post']).to be_present