Project

General

Profile

Reassign back to original author

Added by Brett Patterson about 15 years ago

We've got a post-commit hook going at work (the same as the one in the wiki) and it works great. One thing we wanted was that if we noted a revision as fixing an issue, it should not only just set it to a specific status, but also to reassign it back to the original author.

So I went in an hacked it together and I believe it works; however, I can't say it's the most efficient way to do it. Perhaps the only thing missing is a config flag of "Reassign to author on verify & close?" in the section with the fixes keywords.

Here's the code:

           issue.done_ratio = done_ratio if done_ratio

           # Reassign back to original author, or default to nobody
           reassign_to = nil
           issue.assignable_users.each do |assignuser|
                 reassign_to = assignuser if assignuser.id == issue.author_id
           end
           issue.assigned_to = reassign_to
           # End reassign to original author

           Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update,
                                  { :changeset => self, :issue => issue })
           issue.save

This goes in app/models/changeset.rb right around line 114.

Thoughts on adding this in to 0.8.7?


Replies (1)

RE: Reassign back to original author - Added by Felix Schäfer about 15 years ago

I think you should file this as a feature request, as I'm not sure how often the devs read the forums :-)

    (1-1/1)