Fixed: Private flag ignored when creating an issue with set_own_issues_private permission only (#8472).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5991 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
05ff5aa11e
commit
fccf15c2a2
|
@ -301,6 +301,7 @@ private
|
|||
end
|
||||
|
||||
@issue.project = @project
|
||||
@issue.author = User.current
|
||||
# Tracker must be set before custom field values
|
||||
@issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
|
||||
if @issue.tracker.nil?
|
||||
|
@ -314,7 +315,6 @@ private
|
|||
@issue.watcher_user_ids = params[:issue]['watcher_user_ids']
|
||||
end
|
||||
end
|
||||
@issue.author = User.current
|
||||
@priorities = IssuePriority.all
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
|
||||
end
|
||||
|
|
|
@ -22,6 +22,7 @@ roles_001:
|
|||
- :delete_issues
|
||||
- :view_issue_watchers
|
||||
- :add_issue_watchers
|
||||
- :set_issues_private
|
||||
- :delete_issue_watchers
|
||||
- :manage_public_queries
|
||||
- :save_queries
|
||||
|
|
|
@ -607,6 +607,36 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
assert_nil issue.parent
|
||||
end
|
||||
|
||||
def test_post_create_private
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_difference 'Issue.count' do
|
||||
post :create, :project_id => 1,
|
||||
:issue => {:tracker_id => 1,
|
||||
:subject => 'This is a private issue',
|
||||
:is_private => '1'}
|
||||
end
|
||||
issue = Issue.first(:order => 'id DESC')
|
||||
assert issue.is_private?
|
||||
end
|
||||
|
||||
def test_post_create_private_with_set_own_issues_private_permission
|
||||
role = Role.find(1)
|
||||
role.remove_permission! :set_issues_private
|
||||
role.add_permission! :set_own_issues_private
|
||||
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
assert_difference 'Issue.count' do
|
||||
post :create, :project_id => 1,
|
||||
:issue => {:tracker_id => 1,
|
||||
:subject => 'This is a private issue',
|
||||
:is_private => '1'}
|
||||
end
|
||||
issue = Issue.first(:order => 'id DESC')
|
||||
assert issue.is_private?
|
||||
end
|
||||
|
||||
def test_post_create_should_send_a_notification
|
||||
ActionMailer::Base.deliveries.clear
|
||||
@request.session[:user_id] = 2
|
||||
|
|
Loading…
Reference in New Issue