mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 00:08:53 +08:00
Merge pull request #4137 from cpradio/add-warning-to-flag
FEATURE: Add warning input to flag dialog when notifying a user
This commit is contained in:
@ -49,6 +49,17 @@ describe PostActionsController do
|
||||
xhr :post, :create, id: @post.id, post_action_type_id: PostActionType.types[:like], message: 'action message goes here'
|
||||
end
|
||||
|
||||
it 'passes the message through as warning' do
|
||||
PostAction.expects(:act).once.with(@user, @post, PostActionType.types[:like], {message: 'action message goes here', is_warning: true})
|
||||
xhr :post, :create, id: @post.id, post_action_type_id: PostActionType.types[:like], message: 'action message goes here', is_warning: true
|
||||
end
|
||||
|
||||
it "doesn't create message as a warning if the user isn't staff" do
|
||||
Guardian.any_instance.stubs(:is_staff?).returns(false)
|
||||
PostAction.expects(:act).once.with(@user, @post, PostActionType.types[:like], {message: 'action message goes here'})
|
||||
xhr :post, :create, id: @post.id, post_action_type_id: PostActionType.types[:like], message: 'action message goes here', is_warning: true
|
||||
end
|
||||
|
||||
it 'passes take_action through' do
|
||||
PostAction.expects(:act).once.with(@user, @post, PostActionType.types[:like], {take_action: true})
|
||||
xhr :post, :create, id: @post.id, post_action_type_id: PostActionType.types[:like], take_action: 'true'
|
||||
|
Reference in New Issue
Block a user