My scenario an issue change status in "closed" and redmine must send an email to an email address
My constraint:
- issue assignee could not change
- email must be configurable by user administration
- only one email for issue
I'm currently using Redmine 2.4.3 final and because I'm not able to find a setting or existing plugin to get this done, I'm writting down a plugin, here my code:
require 'mailer'
module IssueAssignToPlugin
class Hooks < Redmine::Hook::ViewListener
def controller_issues_edit_before_save(context={})
configuration = Setting.plugin_helloworldredmineplugin
if !configuration.nil? && configuration['enabled'] && !configuration['user_id'].blank? && !configuration['status_id'].blank?
issue = context[:issue]
status = IssueStatus.find(configuration['status_id'])
user = User.find(configuration['user_id'])
if !user.nil? && !issue.watched_by?(user)
if issue.status == status
#issue.add_watcher(user)
#journal = issue.journals.last
#journal = Journal.new(:journalized => issue, :user => user, :created_on => Time.now)
#journal.details << JournalDetail.new(:property => 'relation', :prop_key => 'label_relates_to', :value => 2)
#Mailer.deliver_issue_edit(journal)
#mail(to: user.mail, cc: user.mail, bbc: user.mail)
#Mailer.deliver_mail(mail)
#
#Your code goes here!
#
end
end
end
return ''
end
alias_method :controller_issues_bulk_edit_before_save, :controller_issues_edit_before_save
alias_method :controller_issues_new_before_save, :controller_issues_edit_before_save
end
end
As you can see I've tried many ways, but without luck.
Could someone please help me? My problem is "just" send an Email having only user.mail and using Redmine "settings"