@@ -74,21 +74,22 class Changeset < ActiveRecord::Base | |||
|
74 | 74 | def project |
|
75 | 75 | repository.project |
|
76 | 76 | end |
|
77 | ||
|
77 | ||
|
78 | 78 | def author |
|
79 | 79 | user || committer.to_s.split('<').first |
|
80 | 80 | end |
|
81 | ||
|
81 | ||
|
82 | 82 | def before_create |
|
83 | 83 | self.committer = self.class.to_utf8(self.committer, repository.repo_log_encoding) |
|
84 |
self.comments = self.class.normalize_comments( |
|
|
84 | self.comments = self.class.normalize_comments( | |
|
85 | self.comments, repository.repo_log_encoding) | |
|
85 | 86 | self.user = repository.find_committer_user(self.committer) |
|
86 | 87 | end |
|
87 | 88 | |
|
88 | 89 | def after_create |
|
89 | 90 | scan_comment_for_issue_ids |
|
90 | 91 | end |
|
91 | ||
|
92 | ||
|
92 | 93 | TIMELOG_RE = / |
|
93 | 94 | ( |
|
94 | 95 | ((\d+)(h|hours?))((\d+)(m|min)?)? |
@@ -174,7 +175,9 class Changeset < ActiveRecord::Base | |||
|
174 | 175 | return nil if id.blank? |
|
175 | 176 | issue = Issue.find_by_id(id.to_i, :include => :project) |
|
176 | 177 | if issue |
|
177 | unless issue.project && (project == issue.project || project.is_ancestor_of?(issue.project) || project.is_descendant_of?(issue.project)) | |
|
178 | unless issue.project && | |
|
179 | (project == issue.project || project.is_ancestor_of?(issue.project) || | |
|
180 | project.is_descendant_of?(issue.project)) | |
|
178 | 181 | issue = nil |
|
179 | 182 | end |
|
180 | 183 | end |
@@ -205,14 +208,15 class Changeset < ActiveRecord::Base | |||
|
205 | 208 | end |
|
206 | 209 | issue |
|
207 | 210 | end |
|
208 | ||
|
211 | ||
|
209 | 212 | def log_time(issue, hours) |
|
210 | 213 | time_entry = TimeEntry.new( |
|
211 | 214 | :user => user, |
|
212 | 215 | :hours => hours, |
|
213 | 216 | :issue => issue, |
|
214 | 217 | :spent_on => commit_date, |
|
215 |
:comments => l(:text_time_logged_by_changeset, :value => text_tag, |
|
|
218 | :comments => l(:text_time_logged_by_changeset, :value => text_tag, | |
|
219 | :locale => Setting.default_language) | |
|
216 | 220 | ) |
|
217 | 221 | time_entry.activity = log_time_activity unless log_time_activity.nil? |
|
218 | 222 | |
@@ -221,13 +225,13 class Changeset < ActiveRecord::Base | |||
|
221 | 225 | end |
|
222 | 226 | time_entry |
|
223 | 227 | end |
|
224 | ||
|
228 | ||
|
225 | 229 | def log_time_activity |
|
226 | 230 | if Setting.commit_logtime_activity_id.to_i > 0 |
|
227 | 231 | TimeEntryActivity.find_by_id(Setting.commit_logtime_activity_id.to_i) |
|
228 | 232 | end |
|
229 | 233 | end |
|
230 | ||
|
234 | ||
|
231 | 235 | def split_comments |
|
232 | 236 | comments =~ /\A(.+?)\r?\n(.*)$/m |
|
233 | 237 | @short_comments = $1 || comments |
General Comments 0
You need to be logged in to leave comments.
Login now