mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
Revert "Revert "FEATURE: Can create warnings for users via PM""
This reverts commit 1c7559380c
.
This commit is contained in:
parent
1c7559380c
commit
334e21a03a
37 changed files with 243 additions and 18 deletions
|
@ -384,6 +384,7 @@ describe PostsController do
|
|||
describe 'when logged in' do
|
||||
|
||||
let!(:user) { log_in }
|
||||
let(:moderator) { log_in(:moderator) }
|
||||
let(:new_post) { Fabricate.build(:post, user: user) }
|
||||
|
||||
it "raises an exception without a raw parameter" do
|
||||
|
@ -492,6 +493,24 @@ describe PostsController do
|
|||
xhr :post, :create, {raw: 'hello', meta_data: {xyz: 'abc'}}
|
||||
end
|
||||
|
||||
context "is_warning" do
|
||||
it "doesn't pass `is_warning` through if you're not staff" do
|
||||
PostCreator.expects(:new).with(user, Not(has_entries('is_warning' => true))).returns(post_creator)
|
||||
xhr :post, :create, {raw: 'hello', archetype: 'private_message', is_warning: 'true'}
|
||||
end
|
||||
|
||||
it "passes `is_warning` through if you're staff" do
|
||||
PostCreator.expects(:new).with(moderator, has_entries('is_warning' => true)).returns(post_creator)
|
||||
xhr :post, :create, {raw: 'hello', archetype: 'private_message', is_warning: 'true'}
|
||||
end
|
||||
|
||||
it "passes `is_warning` as false through if you're staff" do
|
||||
PostCreator.expects(:new).with(moderator, has_entries('is_warning' => false)).returns(post_creator)
|
||||
xhr :post, :create, {raw: 'hello', archetype: 'private_message', is_warning: 'false'}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue