##// END OF EJS Templates
Adds a setting that allows to reference/fix issues of all projects (#3087)....
Jean-Philippe Lang -
r8630:d02f6a8e32d1
parent child
Show More
@@ -187,11 +187,13 class Changeset < ActiveRecord::Base
187 187 private
188 188
189 189 # Finds an issue that can be referenced by the commit message
190 # i.e. an issue that belong to the repository project, a subproject or a parent project
191 190 def find_referenced_issue_by_id(id)
192 191 return nil if id.blank?
193 192 issue = Issue.find_by_id(id.to_i, :include => :project)
194 if issue
193 if Setting.commit_cross_project_ref?
194 # all issues can be referenced/fixed
195 elsif issue
196 # issue that belong to the repository project, a subproject or a parent project only
195 197 unless issue.project &&
196 198 (project == issue.project || project.is_ancestor_of?(issue.project) ||
197 199 project.is_descendant_of?(issue.project))
@@ -81,6 +81,8
81 81 :label => false %>
82 82 <br /><em><%= l(:text_comma_separated) %></em></p>
83 83
84 <p><%= setting_check_box :commit_cross_project_ref %></p>
85
84 86 <p><%= setting_check_box :commit_logtime_enabled,
85 87 :onclick =>
86 88 "if (this.checked) { Form.Element.enable('settings_commit_logtime_activity_id'); } else { Form.Element.disable('settings_commit_logtime_activity_id'); }"%></p>
@@ -1017,3 +1017,4 ar:
1017 1017 label_completed_versions: Completed versions
1018 1018 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1019 1019 field_multiple: Multiple values
1020 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1015,3 +1015,4 bg:
1015 1015 description_date_range_interval: Π˜Π·Π±Π΅Ρ€Π΅Ρ‚Π΅ Π΄ΠΈΠ°ΠΏΠ°Π·ΠΎΠ½ Ρ‡Ρ€Π΅Π· Π·Π°Π΄Π°Π²Π°Π½Π΅ Π½Π° Π½Π°Ρ‡Π°Π»Π½Π° ΠΈ ΠΊΡ€Π°ΠΉΠ½Π° Π΄Π°Ρ‚ΠΈ
1016 1016 description_date_from: Π’ΡŠΠ²Π΅Π΄Π΅Ρ‚Π΅ Π½Π°Ρ‡Π°Π»Π½Π° Π΄Π°Ρ‚Π°
1017 1017 description_date_to: Π’ΡŠΠ²Π΅Π΄Π΅Ρ‚Π΅ ΠΊΡ€Π°ΠΉΠ½Π° Π΄Π°Ρ‚Π°
1018 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1031,3 +1031,4 bs:
1031 1031 label_completed_versions: Completed versions
1032 1032 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1033 1033 field_multiple: Multiple values
1034 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1019,3 +1019,4 ca:
1019 1019 label_completed_versions: Completed versions
1020 1020 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1021 1021 field_multiple: Multiple values
1022 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1020,3 +1020,4 cs:
1020 1020 label_completed_versions: Completed versions
1021 1021 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1022 1022 field_multiple: Multiple values
1023 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1034,3 +1034,4 da:
1034 1034 label_completed_versions: Completed versions
1035 1035 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1036 1036 field_multiple: Multiple values
1037 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1037,3 +1037,4 de:
1037 1037 label_item_position: "%{position}/%{count}"
1038 1038 label_completed_versions: Completed versions
1039 1039 field_multiple: Multiple values
1040 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1017,3 +1017,4 el:
1017 1017 label_completed_versions: Completed versions
1018 1018 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1019 1019 field_multiple: Multiple values
1020 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1019,3 +1019,4 en-GB:
1019 1019 label_item_position: "%{position} of %{count}"
1020 1020 label_completed_versions: Completed versions
1021 1021 field_multiple: Multiple values
1022 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -380,6 +380,7 en:
380 380 setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
381 381 setting_issue_group_assignment: Allow issue assignment to groups
382 382 setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
383 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
383 384
384 385 permission_add_project: Create project
385 386 permission_add_subprojects: Create subprojects
@@ -1054,3 +1054,4 es:
1054 1054 label_completed_versions: Completed versions
1055 1055 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1056 1056 field_multiple: Multiple values
1057 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1020,3 +1020,4 eu:
1020 1020 label_completed_versions: Completed versions
1021 1021 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1022 1022 field_multiple: Multiple values
1023 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1019,3 +1019,4 fa:
1019 1019 label_completed_versions: Completed versions
1020 1020 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1021 1021 field_multiple: Multiple values
1022 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1038,3 +1038,4 fi:
1038 1038 label_completed_versions: Completed versions
1039 1039 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1040 1040 field_multiple: Multiple values
1041 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -376,6 +376,7 fr:
376 376 setting_gantt_items_limit: Nombre maximum d'Γ©lΓ©ments affichΓ©s sur le gantt
377 377 setting_issue_group_assignment: Permettre l'assignement des demandes aux groupes
378 378 setting_default_issue_start_date_to_creation_date: Donner Γ  la date de dΓ©but d'une nouvelle demande la valeur de la date du jour
379 setting_commit_cross_project_ref: Permettre le rΓ©fΓ©rencement et la rΓ©solution des demandes de tous les autres projets
379 380
380 381 permission_add_project: CrΓ©er un projet
381 382 permission_add_subprojects: CrΓ©er des sous-projets
@@ -1028,3 +1028,4 gl:
1028 1028 label_completed_versions: Completed versions
1029 1029 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1030 1030 field_multiple: Multiple values
1031 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1022,3 +1022,4 he:
1022 1022 label_completed_versions: Completed versions
1023 1023 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1024 1024 field_multiple: Multiple values
1025 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1023,3 +1023,4 hr:
1023 1023 label_completed_versions: Completed versions
1024 1024 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1025 1025 field_multiple: Multiple values
1026 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1036,3 +1036,4
1036 1036 label_completed_versions: Completed versions
1037 1037 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1038 1038 field_multiple: Multiple values
1039 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1023,3 +1023,4 id:
1023 1023 label_completed_versions: Completed versions
1024 1024 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1025 1025 field_multiple: Multiple values
1026 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1018,3 +1018,4 it:
1018 1018 label_completed_versions: Completed versions
1019 1019 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1020 1020 field_multiple: Multiple values
1021 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1047,3 +1047,4 ja:
1047 1047 label_completed_versions: Completed versions
1048 1048 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1049 1049 field_multiple: Multiple values
1050 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1069,3 +1069,4 ko:
1069 1069 label_completed_versions: Completed versions
1070 1070 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1071 1071 field_multiple: Multiple values
1072 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1077,3 +1077,4 lt:
1077 1077 label_completed_versions: Completed versions
1078 1078 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1079 1079 field_multiple: Multiple values
1080 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1011,3 +1011,4 lv:
1011 1011 label_completed_versions: Completed versions
1012 1012 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1013 1013 field_multiple: Multiple values
1014 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1017,3 +1017,4 mk:
1017 1017 label_completed_versions: Completed versions
1018 1018 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1019 1019 field_multiple: Multiple values
1020 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1017,3 +1017,4 mn:
1017 1017 label_completed_versions: Completed versions
1018 1018 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1019 1019 field_multiple: Multiple values
1020 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -999,3 +999,4 nl:
999 999 label_item_position: "%{position}/%{count}"
1000 1000 label_completed_versions: Completed versions
1001 1001 field_multiple: Multiple values
1002 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1007,3 +1007,4
1007 1007 label_completed_versions: Completed versions
1008 1008 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1009 1009 field_multiple: Multiple values
1010 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1034,3 +1034,4 pl:
1034 1034 label_completed_versions: Completed versions
1035 1035 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1036 1036 field_multiple: Multiple values
1037 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1040,3 +1040,4 pt-BR:
1040 1040 label_completed_versions: Completed versions
1041 1041 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1042 1042 field_multiple: Multiple values
1043 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1022,3 +1022,4 pt:
1022 1022 label_completed_versions: Completed versions
1023 1023 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1024 1024 field_multiple: Multiple values
1025 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1014,3 +1014,4 ro:
1014 1014 label_completed_versions: Completed versions
1015 1015 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1016 1016 field_multiple: Multiple values
1017 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1130,3 +1130,4 ru:
1130 1130 label_completed_versions: Completed versions
1131 1131 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1132 1132 field_multiple: Multiple values
1133 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1017,3 +1017,4 sk:
1017 1017 label_completed_versions: Completed versions
1018 1018 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1019 1019 field_multiple: Multiple values
1020 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1017,3 +1017,4 sl:
1017 1017 label_completed_versions: Completed versions
1018 1018 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1019 1019 field_multiple: Multiple values
1020 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1017,3 +1017,4 sr-YU:
1017 1017 label_completed_versions: Completed versions
1018 1018 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1019 1019 field_multiple: Multiple values
1020 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1018,3 +1018,4 sr:
1018 1018 label_completed_versions: Completed versions
1019 1019 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1020 1020 field_multiple: Multiple values
1021 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1058,3 +1058,4 sv:
1058 1058 label_completed_versions: Completed versions
1059 1059 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1060 1060 field_multiple: Multiple values
1061 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1014,3 +1014,4 th:
1014 1014 label_completed_versions: Completed versions
1015 1015 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1016 1016 field_multiple: Multiple values
1017 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1036,3 +1036,4 tr:
1036 1036 label_completed_versions: Completed versions
1037 1037 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1038 1038 field_multiple: Multiple values
1039 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1014,3 +1014,4 uk:
1014 1014 label_completed_versions: Completed versions
1015 1015 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1016 1016 field_multiple: Multiple values
1017 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1068,3 +1068,4 vi:
1068 1068 label_completed_versions: Completed versions
1069 1069 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1070 1070 field_multiple: Multiple values
1071 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1097,3 +1097,4
1097 1097 label_completed_versions: Completed versions
1098 1098 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1099 1099 field_multiple: Multiple values
1100 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -1019,3 +1019,4 zh:
1019 1019 label_completed_versions: Completed versions
1020 1020 text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
1021 1021 field_multiple: Multiple values
1022 setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
@@ -92,6 +92,8 sys_api_enabled:
92 92 default: 0
93 93 sys_api_key:
94 94 default: ''
95 commit_cross_project_ref:
96 default: 0
95 97 commit_ref_keywords:
96 98 default: 'refs,references,IssueID'
97 99 commit_fix_keywords:
@@ -192,6 +192,36 class ChangesetTest < ActiveSupport::TestCase
192 192 assert c.issues.first.project != c.project
193 193 end
194 194
195 def test_commit_referencing_a_project_with_commit_cross_project_ref_disabled
196 r = Repository::Subversion.create!(
197 :project => Project.find(3),
198 :url => 'svn://localhost/test')
199
200 with_settings :commit_cross_project_ref => '0' do
201 c = Changeset.new(:repository => r,
202 :committed_on => Time.now,
203 :comments => 'refs #4, an issue of a different project',
204 :revision => '12345')
205 assert c.save
206 assert_equal [], c.issue_ids
207 end
208 end
209
210 def test_commit_referencing_a_project_with_commit_cross_project_ref_enabled
211 r = Repository::Subversion.create!(
212 :project => Project.find(3),
213 :url => 'svn://localhost/test')
214
215 with_settings :commit_cross_project_ref => '1' do
216 c = Changeset.new(:repository => r,
217 :committed_on => Time.now,
218 :comments => 'refs #4, an issue of a different project',
219 :revision => '12345')
220 assert c.save
221 assert_equal [4], c.issue_ids
222 end
223 end
224
195 225 def test_text_tag_revision
196 226 c = Changeset.new(:revision => '520')
197 227 assert_equal 'r520', c.text_tag
General Comments 0
You need to be logged in to leave comments. Login now