Project

General

Profile

Actions

Defect #14298

closed

Error generated on 'search for watchers to add' after clicking add without selected users

Added by Ricardo S over 11 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Issues
Target version:
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

Has duplicate Redmine - Defect #16379: Undefined method `each' for nil:NilClass on search for watchers to addClosed

Actions
Actions #1

Updated by Jean-Philippe Lang almost 11 years ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.5.1
  • Resolution set to Fixed

Fixed in r12985.

Actions #2

Updated by Jean-Philippe Lang almost 11 years ago

  • Has duplicate Defect #16379: Undefined method `each' for nil:NilClass on search for watchers to add added
Actions #3

Updated by Jean-Philippe Lang over 10 years ago

  • Status changed from Resolved to Closed

Merged.

Actions

Also available in: Atom PDF