Defect #4163 » patch-cp-issue-keywords_2.diff
| app/controllers/issues_controller.rb | ||
|---|---|---|
|
@changesets = @issue.changesets
|
||
|
@changesets.reverse! if User.current.wants_comments_in_reverse_order?
|
||
|
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||
|
@allowed_changesets = @issue.changesets.select do |changeset|
|
||
|
User.current.allowed_to?(:view_changesets, changeset.project)
|
||
|
end
|
||
|
@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
|
||
|
@priorities = IssuePriority.all
|
||
|
@time_entry = TimeEntry.new
|
||
| app/models/changeset.rb | ||
|---|---|---|
|
# status and optional done ratio applied
|
||
|
fix_status = IssueStatus.find_by_id(Setting.commit_fix_status_id)
|
||
|
done_ratio = Setting.commit_fix_done_ratio.blank? ? nil : Setting.commit_fix_done_ratio.to_i
|
||
|
if Setting.cross_project_commit_keywords?
|
||
|
issues_finder = Issue
|
||
|
else
|
||
|
issues_finder = repository.project.issues
|
||
|
end
|
||
|
|
||
|
kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw)}.join("|")
|
||
|
return if kw_regexp.blank?
|
||
| ... | ... | |
|
# find any issue ID in the comments
|
||
|
target_issue_ids = []
|
||
|
comments.scan(%r{([\s\(\[,-]|^)#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] }
|
||
|
referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids)
|
||
|
referenced_issues += issues_finder.find_all_by_id(target_issue_ids)
|
||
|
end
|
||
|
|
||
|
comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match|
|
||
|
action = match[0]
|
||
|
target_issue_ids = match[1].scan(/\d+/)
|
||
|
target_issues = repository.project.issues.find_all_by_id(target_issue_ids)
|
||
|
target_issues = issues_finder.find_all_by_id(target_issue_ids)
|
||
|
if fix_status && fix_keywords.include?(action.downcase)
|
||
|
# update status of issues
|
||
|
logger.debug "Issues fixed by changeset #{self.revision}: #{issue_ids.join(', ')}." if logger && logger.debug?
|
||
| app/views/issues/show.rhtml | ||
|---|---|---|
|
</div>
|
||
|
<% if @changesets.any? && User.current.allowed_to?(:view_changesets, @project) %>
|
||
|
<% if @allowed_changesets.any? %>
|
||
|
<div id="issue-changesets">
|
||
|
<h3><%=l(:label_associated_revisions)%></h3>
|
||
|
<%= render :partial => 'changesets', :locals => { :changesets => @changesets} %>
|
||
|
<%= render :partial => 'changesets', :locals => { :changesets => @allowed_changesets} %>
|
||
|
</div>
|
||
|
<% end %>
|
||
| app/views/settings/_repositories.rhtml | ||
|---|---|---|
|
<%= check_box_tag 'settings[sys_api_enabled]', 1, Setting.sys_api_enabled? %>
|
||
|
</p>
|
||
|
<p><label><%= l(:setting_cross_project_commit_keywords) %></label>
|
||
|
<%= hidden_field_tag 'settings[cross_project_commit_keywords]', 0 %>
|
||
|
<%= check_box_tag 'settings[cross_project_commit_keywords]', 1, Setting.cross_project_commit_keywords? %>
|
||
|
</p>
|
||
|
<p><label><%= l(:setting_enabled_scm) %></label>
|
||
|
<% REDMINE_SUPPORTED_SCM.each do |scm| -%>
|
||
|
<%= check_box_tag 'settings[enabled_scm][]', scm, Setting.enabled_scm.include?(scm) %> <%= scm %>
|
||
| config/locales/en.yml | ||
|---|---|---|
|
setting_default_projects_public: New projects are public by default
|
||
|
setting_autofetch_changesets: Autofetch commits
|
||
|
setting_sys_api_enabled: Enable WS for repository management
|
||
|
setting_cross_project_commit_keywords: Allow cross project references in commit messages
|
||
|
setting_commit_ref_keywords: Referencing keywords
|
||
|
setting_commit_fix_keywords: Fixing keywords
|
||
|
setting_autologin: Autologin
|
||
| config/settings.yml | ||
|---|---|---|
|
default: 0
|
||
|
commit_fix_done_ratio:
|
||
|
default: 100
|
||
|
cross_project_commit_keywords:
|
||
|
default: 0
|
||
|
# autologin duration in days
|
||
|
# 0 means autologin is disabled
|
||
|
autologin:
|
||
| test/unit/repository_test.rb | ||
|---|---|---|
|
|
||
|
# ignoring commits referencing an issue of another project
|
||
|
assert_equal [], Issue.find(4).changesets
|
||
|
Setting.cross_project_commit_keywords = 1
|
||
|
Repository.scan_changesets_for_issue_ids
|
||
|
assert_equal [103], Issue.find(4).changeset_ids
|
||
|
end
|
||
|
|
||
|
def test_for_changeset_comments_strip
|
||
- « Previous
- 1
- 2
- Next »