Actions
Defect #14298
closedError generated on 'search for watchers to add' after clicking add without selected users
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
On the New Issue page, after clicking Add on Search for watchers to add without selecting any user, generates the following error on the logs:
An ActionView::Template::Error occurred in watchers#append: undefined method `each' for nil:NilClass app/views/watchers/append.js.erb:1:in `_app_views_watchers_append_js_erb__1816769395046035616_62007020' actionpack (3.2.13) lib/action_view/template.rb:145:in `block in render' activesupport (3.2.13) lib/active_support/notifications.rb:125:in `instrument' actionpack (3.2.13) lib/action_view/template.rb:143:in `render' actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template' actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument' (...)
A possible fix is to change WatchersController#append to render nothing when no user is selected:
def append
if params[:watcher].is_a?(Hash)
user_ids = params[:watcher][:user_ids] || [params[:watcher][:user_id]]
@users = User.active.find_all_by_id(user_ids)
else
render :nothing => true
end
end
My redmine environment is:
---
Environment: Redmine version 2.3.1.devel Ruby version 1.9.3 (x86_64-linux) Rails version 3.2.13 Environment production Database adapter PostgreSQL SCM: Subversion 1.7.5 Mercurial 2.6.1 Cvs 1.12.13 Bazaar 2.6 Git 1.7.10.4 Filesystem
Related issues
Actions