Actions
Defect #40410
closedWatcher groups on new issue form get dereferenced on validation error
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
When creating a new issue, selecting a group as a watcher and causing a validation error (for example leave the subject blank), all users of the group will be selected in addition to the initially selected group.
This test shows the problem:
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index cce8ddc625..fb401c701d 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -4778,6 +4778,25 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'input[name=?][value="8"][checked=checked]', 'issue[watcher_user_ids][]'
end
+ def test_post_create_with_failure_should_not_dereference_group_watchers
+ @request.session[:user_id] = 1
+ post(
+ :create,
+ :params => {
+ :project_id => 5,
+ :issue => {
+ :tracker_id => 1,
+ :watcher_user_ids => ['11']
+ }
+ }
+ )
+ assert_response :success
+
+ # The group's user was not explicitely selected
+ assert_select 'input[name=?][value="8"][checked=checked]', 'issue[watcher_user_ids][]', 0
+ assert_select 'input[name=?][value="11"][checked=checked]', 'issue[watcher_user_ids][]', 1
+ end
+
def test_post_create_should_ignore_non_safe_attributes
@request.session[:user_id] = 2
assert_nothing_raised do
(Please note: The test above the one proposed in the diff uses the :not(checked)
pseudo-selector, this however does not seem to work as expected)
Related issues
Updated by Marius BĂLTEANU 4 months ago
- Has duplicate Defect #40555: Watcher group checkbox on new issue form on validation error will be checked only submitted added
Updated by Marius BĂLTEANU 4 months ago
- Status changed from New to Resolved
- Assignee set to Marius BĂLTEANU
- Target version set to 5.0.9
- Resolution set to Fixed
I've committed the fix from #40410, thanks for reporting and for the test.
Updated by Marius BĂLTEANU 4 months ago
- Related to Feature #4511: Allow adding user groups as watchers for issues added
Actions