Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

create journal when auto-closing issues

  • Loading branch information...
commit da1af62618911c3a730a2b24b2596d59c183a443 1 parent c7a69e2
@jkraemer authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/issue_reminder.rb
View
7 lib/issue_reminder.rb
@@ -7,6 +7,7 @@ def self.deliver_issue_reminders
end
def self.close_old_resolved_issues
+ # FIXME make the resolved / closed states configurable
resolved = IssueStatus.find_by_name 'Gelöst'
closed = IssueStatus.find_by_name 'Geschlossen'
Issue.find(:all,
@@ -15,8 +16,12 @@ def self.close_old_resolved_issues
Setting.plugin_redmine_issue_reminder['close_issues_after_days'].to_i.days.ago,
resolved.id
]).each do |issue|
+ # closing parent issues closes child issues, too.
+ # that may lead to stale, already closed issues in our list.
i = Issue.find issue.id
- i.update_attribute :status, closed unless i.closed?
+ next if i.closed?
+ i.init_journal(User.anonymous, "automatic close after #{Setting.plugin_redmine_issue_reminder['close_issues_after_days']} days")
+ i.update_attribute :status, closed
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.