FEATURE: Allow Markdown in post notices. (#7864)

This commit is contained in:
Dan Ungureanu
2019-07-09 14:42:02 +03:00
committed by GitHub
parent 6b0cc9e22e
commit 9f5cfa192e
6 changed files with 43 additions and 14 deletions

View File

@@ -1789,4 +1789,27 @@ describe PostsController do
expect(public_post).not_to be_locked
end
end
describe "#notice" do
before do
sign_in(moderator)
end
it 'can create and remove notices' do
put "/posts/#{public_post.id}/notice.json", params: { notice: "Hello *world*!\n\nhttps://github.com/discourse/discourse" }
expect(response.status).to eq(200)
public_post.reload
expect(public_post.custom_fields['notice_type']).to eq(Post.notices[:custom])
expect(public_post.custom_fields['notice_args']).to include('<p>Hello <em>world</em>!</p>')
expect(public_post.custom_fields['notice_args']).not_to include('onebox')
put "/posts/#{public_post.id}/notice.json", params: { notice: nil }
expect(response.status).to eq(200)
public_post.reload
expect(public_post.custom_fields['notice_type']).to eq(nil)
expect(public_post.custom_fields['notice_args']).to eq(nil)
end
end
end