Project

General

Profile

Defect #6681 » issue-auto-close.diff

Toshi MARUYAMA, 2010-10-15 14:45

View differences:

app/models/changeset.rb
62 62
      identifier[0, 8]
63 63
    end
64 64
  end
65

  
66
  # Returns the identifier for wiki, "rN" or "commit:ABCDEF"
67
  def format_wiki_identifier
68
    if scmid  # hash-like
69
      "commit:#{scmid}"
70
    else  # numeric
71
      "r#{revision}"
72
    end
73
  end
65 74
  
66 75
  def comments=(comment)
67 76
    write_attribute(:comments, Changeset.normalize_comments(comment))
......
124 133
          issue.reload
125 134
          # don't change the status is the issue is closed
126 135
          next if issue.status.is_closed?
127
          csettext = "r#{self.revision}"
128
          if self.scmid && (! (csettext =~ /^r[0-9]+$/))
129
            csettext = "commit:\"#{self.scmid}\""
130
          end
131
          journal = issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, csettext))
136
          journal = issue.init_journal(user || User.anonymous,
137
                                       ll(Setting.default_language, :text_status_changed_by_changeset, format_wiki_identifier))
132 138
          issue.status = fix_status
133 139
          unless Setting.commit_fix_done_ratio.blank?
134 140
            issue.done_ratio = Setting.commit_fix_done_ratio.to_i
(1-1/2)