Mercurial > hg > soundsoftware-site
diff app/controllers/issues_controller.rb @ 145:e80647437550 live
Issue #31: issue submitters and assignees are added to the watchers list.
incomplete: there is no option to select/unselect the assignee.
author | luisf |
---|---|
date | Thu, 20 Jan 2011 13:08:43 +0000 |
parents | 4e2245195548 |
children | 73ff0e6a11b1 |
line wrap: on
line diff
--- a/app/controllers/issues_controller.rb Wed Jan 12 17:06:18 2011 +0000 +++ b/app/controllers/issues_controller.rb Thu Jan 20 13:08:43 2011 +0000 @@ -135,15 +135,12 @@ call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) - # Adds user to watcher's list - # @issue.add_watcher(User.current) - # Also adds the assignee to the watcher's list - # if params[:issue][:assigned_to_id] && !params[:issue][:assigned_to_id].empty?: - # unless @issue.watcher_ids.include?(params[:issue][:assigned_to_id]): - # @issue.add_watcher(User.find(params[:issue][:assigned_to_id])) - # end - # end + if params[:issue][:assigned_to_id] && !params[:issue][:assigned_to_id].empty?: + unless @issue.watcher_ids.include?(params[:issue][:assigned_to_id]): + @issue.add_watcher(User.find(params[:issue][:assigned_to_id])) + end + end respond_to do |format| format.html { @@ -291,11 +288,11 @@ # is in this issues watcher's list # if not, adds it. - # if params[:issue][:assigned_to_id] && !params[:issue][:assigned_to_id].empty?: - # unless @issue.watcher_ids.include?(params[:issue][:assigned_to_id]): - # @issue.add_watcher(User.find(params[:issue][:assigned_to_id])) - # end - # end + if params[:issue][:assigned_to_id] && !params[:issue][:assigned_to_id].empty?: + unless @issue.watched_by?(User.find(params[:issue][:assigned_to_id])): + @issue.add_watcher(User.find(params[:issue][:assigned_to_id])) + end + end end