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