Defect #26880 » fix_26880.patch
app/controllers/issues_controller.rb | ||
---|---|---|
515 | 515 |
attrs.delete(:fixed_version_id) |
516 | 516 |
end |
517 | 517 |
@issue.safe_attributes = attrs |
518 |
@issue.watcher_user_ids = [] if params[:issue] && params[:issue][:watcher_user_ids].blank? |
|
518 | 519 | |
519 | 520 |
if @issue.project |
520 | 521 |
@issue.tracker ||= @issue.allowed_target_trackers.first |
test/functional/issues_controller_test.rb | ||
---|---|---|
4207 | 4207 |
assert_equal 1, issue.project_id |
4208 | 4208 |
end |
4209 | 4209 | |
4210 |
def test_create_as_copy_with_watcher_user_ids_should_copy_watchers |
|
4211 |
@request.session[:user_id] = 2 |
|
4212 |
copied = Issue.generate! |
|
4213 |
copied.add_watcher User.find(2) |
|
4214 |
copied.add_watcher User.find(3) |
|
4215 | ||
4216 |
assert_difference 'Issue.count' do |
|
4217 |
post :create, :params => { |
|
4218 |
:project_id => 1, |
|
4219 |
:copy_from => copied.id, |
|
4220 |
:issue => { |
|
4221 |
:subject => 'Copy cleared watchers', |
|
4222 |
:watcher_user_ids => [3] |
|
4223 |
} |
|
4224 |
} |
|
4225 |
end |
|
4226 |
issue = Issue.order('id DESC').first |
|
4227 |
assert_equal [3], issue.watcher_user_ids |
|
4228 |
end |
|
4229 | ||
4230 |
def test_create_as_copy_without_watcher_user_ids_should_not_copy_watchers |
|
4231 |
@request.session[:user_id] = 2 |
|
4232 |
copied = Issue.generate! |
|
4233 |
copied.add_watcher User.find(2) |
|
4234 |
copied.add_watcher User.find(3) |
|
4235 | ||
4236 |
assert_difference 'Issue.count' do |
|
4237 |
post :create, :params => { |
|
4238 |
:project_id => 1, |
|
4239 |
:copy_from => copied.id, |
|
4240 |
:issue => { |
|
4241 |
:subject => 'Copy cleared watchers' |
|
4242 |
} |
|
4243 |
} |
|
4244 |
end |
|
4245 |
issue = Issue.order('id DESC').first |
|
4246 |
assert_equal [], issue.watcher_user_ids |
|
4247 |
end |
|
4248 | ||
4210 | 4249 |
def test_get_edit |
4211 | 4250 |
@request.session[:user_id] = 2 |
4212 | 4251 |
get :edit, :params => { |
- « Previous
- 1
- 2
- 3
- 4
- Next »