mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 14:01:14 +08:00
FEATURE: add full editing access to queued posts (#5047)
For pending new topics: the body of the post, title, categories and the tags are editable. For pending new replies: only the body is applicable and thus editable DISCUSSION: https://meta.discourse.org/t/66754
This commit is contained in:
@ -27,7 +27,7 @@ describe QueuedPostsController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'update' do
|
||||
describe '#update' do
|
||||
let!(:user) { log_in(:moderator) }
|
||||
let(:qp) { Fabricate(:queued_post) }
|
||||
|
||||
@ -43,7 +43,7 @@ describe QueuedPostsController do
|
||||
end
|
||||
|
||||
context 'rejected' do
|
||||
it 'updates the post to approved' do
|
||||
it 'updates the post to rejected' do
|
||||
|
||||
xhr :put, :update, id: qp.id, queued_post: { state: 'rejected' }
|
||||
expect(response).to be_success
|
||||
@ -53,5 +53,66 @@ describe QueuedPostsController do
|
||||
end
|
||||
end
|
||||
|
||||
context 'editing content' do
|
||||
let(:changes) do
|
||||
{
|
||||
raw: 'new raw',
|
||||
title: 'new title',
|
||||
category_id: 10,
|
||||
tags: ['new_tag']
|
||||
}
|
||||
end
|
||||
|
||||
context 'when it is a topic' do
|
||||
let(:queued_topic) { Fabricate(:queued_topic) }
|
||||
|
||||
before do
|
||||
xhr :put, :update, id: queued_topic.id, queued_post: changes
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it 'updates raw' do
|
||||
expect(queued_topic.reload.raw).to eq(changes[:raw])
|
||||
end
|
||||
|
||||
it 'updates the title' do
|
||||
expect(queued_topic.reload.post_options['title']).to eq(changes[:title])
|
||||
end
|
||||
|
||||
it 'updates the category' do
|
||||
expect(queued_topic.reload.post_options['category']).to eq(changes[:category_id])
|
||||
end
|
||||
|
||||
it 'updates the tags' do
|
||||
expect(queued_topic.reload.post_options['tags']).to eq(changes[:tags])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when it is a reply' do
|
||||
let(:queued_reply) { Fabricate(:queued_post) }
|
||||
|
||||
before do
|
||||
xhr :put, :update, id: queued_reply.id, queued_post: changes
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it 'updates raw' do
|
||||
expect(queued_reply.reload.raw).to eq(changes[:raw])
|
||||
end
|
||||
|
||||
it 'does not update the title' do
|
||||
expect(queued_reply.reload.post_options['title']).to be_nil
|
||||
end
|
||||
|
||||
it 'does not update the category' do
|
||||
original_category = queued_reply.post_options['category']
|
||||
expect(queued_reply.reload.post_options['category']).to eq(original_category)
|
||||
end
|
||||
|
||||
it 'does not update the tags' do
|
||||
expect(queued_reply.reload.post_options['tags']).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user