Index: app/controllers/issues_controller.rb =================================================================== --- app/controllers/issues_controller.rb (revision 574) +++ app/controllers/issues_controller.rb (working copy) @@ -58,13 +58,17 @@ @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x, :customized => @issue) } else begin - @issue.init_journal(self.logged_in_user) + journal = @issue.init_journal(self.logged_in_user) # Retrieve custom fields and values @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } @issue.custom_values = @custom_values @issue.attributes = params[:issue] if @issue.save + @issue.add_watcher(@issue.author) if @issue.author + @issue.add_watcher(@issue.assigned_to) if @issue.assigned_to + flash[:notice] = l(:notice_successful_update) + Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? redirect_to :action => 'show', :id => @issue end rescue ActiveRecord::StaleObjectError @@ -104,7 +108,10 @@ :prop_key => a.id, :value => a.filename) unless a.new_record? } if params[:attachments] and params[:attachments].is_a? Array - + + @issue.add_watcher(@issue.author) if @issue.author + @issue.add_watcher(@issue.assigned_to) if @issue.assigned_to + flash[:notice] = l(:notice_successful_update) Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled? redirect_to :action => 'show', :id => @issue Index: app/controllers/projects_controller.rb =================================================================== --- app/controllers/projects_controller.rb (revision 574) +++ app/controllers/projects_controller.rb (working copy) @@ -249,6 +249,10 @@ @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status @issue.author_id = self.logged_in_user.id if self.logged_in_user + + @issue.add_watcher(self.logged_in_user) if self.logged_in_user + @issue.add_watcher(@issue.assigned_to) if @issue.assigned_to + # Multiple file upload @attachments = [] params[:attachments].each { |a| Index: app/models/mailer.rb =================================================================== --- app/models/mailer.rb (revision 574) +++ app/models/mailer.rb (working copy) @@ -29,7 +29,11 @@ def issue_add(issue) set_language_if_valid(Setting.default_language) # Sends to all project members - @recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact + @recipients = issue.watcher_recipients + @recipients.push issue.assigned_to.mail if issue.assigned_to + @recipients.uniq! + # Managers in cc + #@cc = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification && m.role.name =~ /manager/i }.compact - @recipients @from = Setting.mail_from @subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] #{issue.status.name} - #{issue.subject}" @body['issue'] = issue @@ -39,9 +43,11 @@ set_language_if_valid(Setting.default_language) # Sends to all project members issue = journal.journalized - @recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }.compact - # Watchers in cc - @cc = issue.watcher_recipients - @recipients + @recipients = issue.watcher_recipients + @recipients.push issue.assigned_to.mail if issue.assigned_to + @recipients.uniq! + # Managers in cc + #@cc = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification && m.role.name =~ /manager/i }.compact - @recipients @from = Setting.mail_from @subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}] #{issue.status.name} - #{issue.subject}" @body['issue'] = issue Index: db/migrate/059_set_issue_edit_notifications.rb =================================================================== --- db/migrate/059_set_issue_edit_notifications.rb (revision 0) +++ db/migrate/059_set_issue_edit_notifications.rb (revision 0) @@ -0,0 +1,9 @@ +class SetIssueEditNotifications < ActiveRecord::Migration + def self.up + Permission.find_by_controller_and_action("issues", "edit").update_attribute(:mail_option, true) + end + + def self.down + Permission.find_by_controller_and_action("issues", "edit").update_attribute(:mail_option, false) + end +end Index: lib/redmine/acts_as_watchable/lib/acts_as_watchable.rb =================================================================== --- lib/redmine/acts_as_watchable/lib/acts_as_watchable.rb (revision 574) +++ lib/redmine/acts_as_watchable/lib/acts_as_watchable.rb (working copy) @@ -23,7 +23,7 @@ end def add_watcher(user) - self.watchers << Watcher.new(:user => user) + self.watchers << Watcher.new(:user => user) unless self.watchers.member?(user) end def remove_watcher(user)