title: How to set up automatic adding of a comment in redmine when the issue status changes to a specific one
body: <p>I'm using Redmine 3.4.6 and I need to make it add a comment when the issue status changes to a specific one. I found out that it can be realized by controller issues edit after save hook, but i couldn't find any good example how to write a controller hook. I'm a beginner in Ruby and coding, so i ask somebody to explain what i have to do to make it work.
  <a href="https://i.stack.imgur.com/VWt27.jpg" rel="nofollow noreferrer">Issue</a></p>
  <p>My code:</p>
  <pre><code>module RedmineAutocomments
    module Hooks
      class RedmineAutocommentsHook &lt; Redmine::Hook::ViewListener
        def controller_issues_edit_after_save(context={})
          issue = context[:issue]
          trackers = [&quot;Tracker1&quot;, &quot;Tracker2&quot;, &quot;Tracker3&quot;]
          if trackers.include? @issue.tracker
            if @issue.status == &quot;Ready for handout&quot;
              @comment = Comment.new
              @comment = 'Some comment need to be added'
              @news.comments &lt;&lt; @comment
            end
          end
        end
      end
    end
  end
  </code></pre>