From 69b8b39b6ffd24e79799d099a9b7997b926e8c2d Mon Sep 17 00:00:00 2001 From: Jan Schulz-Hofen Date: Thu, 21 Jun 2012 19:11:42 +0200 Subject: [PATCH] Make repository identifiers frozen after creation --- app/models/repository.rb | 13 ++++++++++++- app/views/projects/_form.html.erb | 2 +- app/views/repositories/_form.html.erb | 5 ++++- config/locales/ar.yml | 2 +- config/locales/bg.yml | 2 +- config/locales/bs.yml | 2 +- config/locales/ca.yml | 2 +- config/locales/cs.yml | 2 +- config/locales/da.yml | 2 +- config/locales/de.yml | 2 +- config/locales/el.yml | 2 +- config/locales/en-GB.yml | 2 +- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- config/locales/et.yml | 2 +- config/locales/eu.yml | 2 +- config/locales/fa.yml | 2 +- config/locales/fi.yml | 2 +- config/locales/fr.yml | 2 +- config/locales/gl.yml | 2 +- config/locales/he.yml | 2 +- config/locales/hr.yml | 2 +- config/locales/hu.yml | 2 +- config/locales/id.yml | 2 +- config/locales/it.yml | 2 +- config/locales/ja.yml | 2 +- config/locales/ko.yml | 2 +- config/locales/lt.yml | 2 +- config/locales/lv.yml | 2 +- config/locales/mk.yml | 2 +- config/locales/mn.yml | 2 +- config/locales/nl.yml | 2 +- config/locales/no.yml | 2 +- config/locales/pl.yml | 2 +- config/locales/pt-BR.yml | 2 +- config/locales/pt.yml | 2 +- config/locales/ro.yml | 2 +- config/locales/ru.yml | 2 +- config/locales/sk.yml | 2 +- config/locales/sl.yml | 2 +- config/locales/sq.yml | 2 +- config/locales/sr-YU.yml | 2 +- config/locales/sr.yml | 2 +- config/locales/sv.yml | 2 +- config/locales/th.yml | 2 +- config/locales/tr.yml | 2 +- config/locales/uk.yml | 2 +- config/locales/vi.yml | 2 +- config/locales/zh-TW.yml | 2 +- config/locales/zh.yml | 2 +- .../functional/repositories_git_controller_test.rb | 4 ++-- test/unit/repository_test.rb | 16 ++++++++++++++++ 52 files changed, 82 insertions(+), 52 deletions(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index c81979a..9a6891a 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -20,6 +20,9 @@ class ScmFetchError < Exception; end class Repository < ActiveRecord::Base include Redmine::Ciphering include Redmine::SafeAttributes + + # Maximum length for repository identifiers + IDENTIFIER_MAX_LENGTH = 255 belongs_to :project has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC" @@ -34,7 +37,7 @@ class Repository < ActiveRecord::Base before_destroy :clear_changesets validates_length_of :password, :maximum => 255, :allow_nil => true - validates_length_of :identifier, :maximum => 255, :allow_blank => true + validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) @@ -114,6 +117,14 @@ class Repository < ActiveRecord::Base end end + def identifier=(identifier) + super unless identifier_frozen? + end + + def identifier_frozen? + errors[:identifier].blank? && !(new_record? || identifier.blank?) + end + def identifier_param if is_default? nil diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb index d7b7554..e1a7744 100644 --- a/app/views/projects/_form.html.erb +++ b/app/views/projects/_form.html.erb @@ -11,7 +11,7 @@

<%= f.text_area :description, :rows => 5, :class => 'wiki-edit' %>

<%= f.text_field :identifier, :required => true, :size => 60, :disabled => @project.identifier_frozen? %> <% unless @project.identifier_frozen? %> - <%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %> + <%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_identifier_info).html_safe %> <% end %>

<%= f.text_field :homepage, :size => 60 %>

<%= f.check_box :is_public %>

diff --git a/app/views/repositories/_form.html.erb b/app/views/repositories/_form.html.erb index 91a19ca..910f940 100644 --- a/app/views/repositories/_form.html.erb +++ b/app/views/repositories/_form.html.erb @@ -9,7 +9,10 @@

<%= f.check_box :is_default, :label => :field_repository_is_default %>

-

<%= f.text_field :identifier %>

+

<%= f.text_field :identifier, :disabled => @repository.identifier_frozen? %> +<% unless @repository.identifier_frozen? %> + <%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_identifier_info).html_safe %> +<% end %>

<% button_disabled = true %> <% if @repository %> diff --git a/config/locales/ar.yml b/config/locales/ar.yml index ee1ff3b..0ecac0e 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -1018,7 +1018,7 @@ ar: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/bg.yml b/config/locales/bg.yml index ad8003c..22c4508 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -932,7 +932,7 @@ bg: text_tip_issue_begin_day: задача, започваща този ден text_tip_issue_end_day: задача, завършваща този ден text_tip_issue_begin_end_day: задача, започваща и завършваща този ден - text_project_identifier_info: 'Позволени са малки букви (a-z), цифри, тирета и _.
Промяна след създаването му не е възможна.' + text_identifier_info: 'Позволени са малки букви (a-z), цифри, тирета и _.
Промяна след създаването му не е възможна.' text_caracters_maximum: "До %{count} символа." text_caracters_minimum: "Минимум %{count} символа." text_length_between: "От %{min} до %{max} символа." diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 2d9e159..3db493a 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -1032,7 +1032,7 @@ bs: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 89645fb..9647120 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -1020,7 +1020,7 @@ ca: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/cs.yml b/config/locales/cs.yml index eb1018b..ebc6a8a 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -1021,7 +1021,7 @@ cs: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/da.yml b/config/locales/da.yml index 99578c7..802bf54 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -1035,7 +1035,7 @@ da: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/de.yml b/config/locales/de.yml index 20b95ed..6a2383e 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -870,7 +870,7 @@ de: text_tip_issue_begin_day: Aufgabe, die an diesem Tag beginnt text_tip_issue_end_day: Aufgabe, die an diesem Tag endet text_tip_issue_begin_end_day: Aufgabe, die an diesem Tag beginnt und endet - text_project_identifier_info: 'Kleinbuchstaben (a-z), Ziffern, Binde- und Unterstriche erlaubt.
Einmal gespeichert, kann die Kennung nicht mehr geändert werden.' + text_identifier_info: 'Kleinbuchstaben (a-z), Ziffern, Binde- und Unterstriche erlaubt.
Einmal gespeichert, kann die Kennung nicht mehr geändert werden.' text_caracters_maximum: "Max. %{count} Zeichen." text_caracters_minimum: "Muss mindestens %{count} Zeichen lang sein." text_length_between: "Länge zwischen %{min} und %{max} Zeichen." diff --git a/config/locales/el.yml b/config/locales/el.yml index 88b4a43..b467943 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -1018,7 +1018,7 @@ el: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index 48597e8..21c7b1c 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -882,7 +882,7 @@ en-GB: text_tip_issue_begin_day: task beginning this day text_tip_issue_end_day: task ending this day text_tip_issue_begin_end_day: task beginning and ending this day - text_project_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed.' + text_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed.' text_caracters_maximum: "%{count} characters maximum." text_caracters_minimum: "Must be at least %{count} characters long." text_length_between: "Length between %{min} and %{max} characters." diff --git a/config/locales/en.yml b/config/locales/en.yml index 05ef97b..dd84dec 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -931,7 +931,7 @@ en: text_tip_issue_begin_day: issue beginning this day text_tip_issue_end_day: issue ending this day text_tip_issue_begin_end_day: issue beginning and ending this day - text_project_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed.' + text_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed.' text_caracters_maximum: "%{count} characters maximum." text_caracters_minimum: "Must be at least %{count} characters long." text_length_between: "Length between %{min} and %{max} characters." diff --git a/config/locales/es.yml b/config/locales/es.yml index e37d57d..9593826 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1055,7 +1055,7 @@ es: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/et.yml b/config/locales/et.yml index b9c8589..b6b69c8 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -944,7 +944,7 @@ et: text_tip_issue_begin_day: "teema avamise päev" text_tip_issue_end_day: "teema sulgemise päev" text_tip_issue_begin_end_day: "teema avati ja sulgeti samal päeval" - text_project_identifier_info: "Lubatud on ainult väikesed tähed (a-z), numbrid ja kriipsud.
Peale salvestamist ei saa tunnust enam muuta." + text_identifier_info: "Lubatud on ainult väikesed tähed (a-z), numbrid ja kriipsud.
Peale salvestamist ei saa tunnust enam muuta." text_caracters_maximum: "%{count} märki kõige rohkem." text_caracters_minimum: "Peab olema vähemalt %{count} märki pikk." text_length_between: "Pikkus %{min} kuni %{max} märki." diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 674c873..ed6137f 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -1021,7 +1021,7 @@ eu: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/fa.yml b/config/locales/fa.yml index a163fa2..45314a9 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -1020,7 +1020,7 @@ fa: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 9157841..3c8115a 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1039,7 +1039,7 @@ fi: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 64b65c2..7905438 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -897,7 +897,7 @@ fr: text_tip_issue_begin_day: tâche commençant ce jour text_tip_issue_end_day: tâche finissant ce jour text_tip_issue_begin_end_day: tâche commençant et finissant ce jour - text_project_identifier_info: 'Seuls les lettres minuscules (a-z), chiffres, tirets et underscore sont autorisés.
Un fois sauvegardé, l''identifiant ne pourra plus être modifié.' + text_identifier_info: 'Seuls les lettres minuscules (a-z), chiffres, tirets et underscore sont autorisés.
Un fois sauvegardé, l''identifiant ne pourra plus être modifié.' text_caracters_maximum: "%{count} caractères maximum." text_caracters_minimum: "%{count} caractères minimum." text_length_between: "Longueur comprise entre %{min} et %{max} caractères." diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 7bed3d6..5f17a4a 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -1029,7 +1029,7 @@ gl: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/he.yml b/config/locales/he.yml index c059bb1..5339771 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -1023,7 +1023,7 @@ he: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 0f75ffb..f7c6666 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -1021,7 +1021,7 @@ hr: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/hu.yml b/config/locales/hu.yml index ad6f65b..1fa4d26 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1037,7 +1037,7 @@ label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/id.yml b/config/locales/id.yml index d85e3fb..2a39b0a 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -1024,7 +1024,7 @@ id: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/it.yml b/config/locales/it.yml index b3dfd5e..8724e73 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1019,7 +1019,7 @@ it: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 64bc6df..a14ca1a 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1048,7 +1048,7 @@ ja: label_copy_attachments: 添付ファイルをコピー label_item_position: "%{position}/%{count}" label_completed_versions: 完了したバージョン - text_project_identifier_info: アルファベット小文字(a-z)・数字・ハイフン・アンダースコアが使えます。
識別子は後で変更することはできません。 + text_identifier_info: アルファベット小文字(a-z)・数字・ハイフン・アンダースコアが使えます。
識別子は後で変更することはできません。 field_multiple: 複数選択可 setting_commit_cross_project_ref: 異なるプロジェクトのチケットの参照/修正を許可 text_issue_conflict_resolution_add_notes: 自分の編集内容を破棄し注記のみ追加 diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 5e00dee..fe82fbf 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1068,7 +1068,7 @@ ko: label_copy_attachments: 첨부파일 복사 label_item_position: "%{position}/%{count}" label_completed_versions: 완료 버전 - text_project_identifier_info: "소문자(a-z),숫자,대쉬(-)와 밑줄(_)만 가능합니다.
식별자는 저장후에는 수정할 수 없습니다." + text_identifier_info: "소문자(a-z),숫자,대쉬(-)와 밑줄(_)만 가능합니다.
식별자는 저장후에는 수정할 수 없습니다." field_multiple: 복수선택가능 setting_commit_cross_project_ref: 다른 프로젝트의 일감 참조 및 수정 허용 text_issue_conflict_resolution_add_notes: 변경내용은 취소하고 덧글만 추가 diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 6c9e6b8..664b625 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -1078,7 +1078,7 @@ lt: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/lv.yml b/config/locales/lv.yml index 35a3797..a05d689 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -1012,7 +1012,7 @@ lv: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/mk.yml b/config/locales/mk.yml index 98ffb7e..063bd04 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -1018,7 +1018,7 @@ mk: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/mn.yml b/config/locales/mn.yml index 5404d93..a5f5f74 100644 --- a/config/locales/mn.yml +++ b/config/locales/mn.yml @@ -1018,7 +1018,7 @@ mn: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 6e11e54..6c39b97 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -763,7 +763,7 @@ nl: text_no_configuration_data: "Rollen, trackers, issue statussen en workflows zijn nog niet geconfigureerd.\nHet is ten zeerste aangeraden om de standaard configuratie in te laden. U kunt deze aanpassen nadat deze is ingeladen." text_plugin_assets_writable: Plugin assets directory beschrijfbaar text_project_destroy_confirmation: Weet u zeker dat u dit project en alle gerelateerde gegevens wilt verwijderen? - text_project_identifier_info: 'Alleen kleine letter (a-z), cijfers, streepjes en liggende streepjes zijn toegestaan.
Eenmaal opgeslagen kan de identifier niet worden gewijzigd.' + text_identifier_info: 'Alleen kleine letter (a-z), cijfers, streepjes en liggende streepjes zijn toegestaan.
Eenmaal opgeslagen kan de identifier niet worden gewijzigd.' text_reassign_time_entries: 'Gerapporteerde uren opnieuw toewijzen:' text_regexp_info: bv. ^[A-Z0-9]+$ text_repository_usernames_mapping: "Koppel de Redminegebruikers aan gebruikers in de repository log.\nGebruikers met dezelfde Redmine en repository gebruikersnaam of email worden automatisch gekoppeld." diff --git a/config/locales/no.yml b/config/locales/no.yml index af57b16..654f784 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -1008,7 +1008,7 @@ label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 07333f5..222b5b0 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1035,7 +1035,7 @@ pl: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index dd103e5..2cf23d1 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1040,7 +1040,7 @@ pt-BR: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 6bc523f..e849cc1 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -1023,7 +1023,7 @@ pt: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/ro.yml b/config/locales/ro.yml index eea6356..c53dfc3 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -1015,7 +1015,7 @@ ro: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 08c958a..1aa1725 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1133,7 +1133,7 @@ ru: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 3d0a955..93ae8de 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -1018,7 +1018,7 @@ sk: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/sl.yml b/config/locales/sl.yml index a95bca4..fd63f86 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -1018,7 +1018,7 @@ sl: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/sq.yml b/config/locales/sq.yml index 33179fc..cbf5247 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -927,7 +927,7 @@ sq: text_tip_issue_begin_day: issue beginning this day text_tip_issue_end_day: issue ending this day text_tip_issue_begin_end_day: issue beginning and ending this day - text_project_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed.' + text_identifier_info: 'Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed.' text_caracters_maximum: "%{count} characters maximum." text_caracters_minimum: "Must be at least %{count} characters long." text_length_between: "Length between %{min} and %{max} characters." diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml index 464c728..641ec27 100644 --- a/config/locales/sr-YU.yml +++ b/config/locales/sr-YU.yml @@ -1018,7 +1018,7 @@ sr-YU: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/sr.yml b/config/locales/sr.yml index ba9988d..f93cdd2 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -1019,7 +1019,7 @@ sr: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 906fae8..6d17fe4 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -969,7 +969,7 @@ sv: text_tip_issue_begin_day: ärende som börjar denna dag text_tip_issue_end_day: ärende som slutar denna dag text_tip_issue_begin_end_day: ärende som börjar och slutar denna dag - text_project_identifier_info: Ändast gemener (a-z), siffror, streck och understreck är tillåtna.
När identifieraren sparats kan den inte ändras. + text_identifier_info: Ändast gemener (a-z), siffror, streck och understreck är tillåtna.
När identifieraren sparats kan den inte ändras. text_caracters_maximum: "max %{count} tecken." text_caracters_minimum: "Måste vara minst %{count} tecken lång." text_length_between: "Längd mellan %{min} och %{max} tecken." diff --git a/config/locales/th.yml b/config/locales/th.yml index db7140e..d058066 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -1015,7 +1015,7 @@ th: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/tr.yml b/config/locales/tr.yml index dd304c2..1aaace1 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1037,7 +1037,7 @@ tr: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/uk.yml b/config/locales/uk.yml index f46523e..c084c25 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -1015,7 +1015,7 @@ uk: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/vi.yml b/config/locales/vi.yml index d3f13ae..749042e 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -1069,7 +1069,7 @@ vi: label_copy_attachments: Copy attachments label_item_position: "%{position}/%{count}" label_completed_versions: Completed versions - text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. + text_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.
Once saved, the identifier cannot be changed. field_multiple: Multiple values setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 308a9c5..20fde33 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1013,7 +1013,7 @@ text_tip_issue_begin_day: 今天起始的問題 text_tip_issue_end_day: 今天截止的的問題 text_tip_issue_begin_end_day: 今天起始與截止的問題 - text_project_identifier_info: '僅允許使用小寫英文字母 (a-z), 阿拉伯數字, 虛線與底線。
一旦儲存之後, 代碼便無法再次被更改。' + text_identifier_info: '僅允許使用小寫英文字母 (a-z), 阿拉伯數字, 虛線與底線。
一旦儲存之後, 代碼便無法再次被更改。' text_caracters_maximum: "最多 %{count} 個字元." text_caracters_minimum: "長度必須大於 %{count} 個字元." text_length_between: "長度必須介於 %{min} 至 %{max} 個字元之間." diff --git a/config/locales/zh.yml b/config/locales/zh.yml index c36c108..471f105 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1020,7 +1020,7 @@ zh: label_copy_attachments: 复制附件 label_item_position: "%{position}/%{count}" label_completed_versions: 已完成的版本 - text_project_identifier_info: 仅小写字母(a-z)、数字、破折号(-)和下划线(_)可以使用。
一旦保存,标识无法修改。 + text_identifier_info: 仅小写字母(a-z)、数字、破折号(-)和下划线(_)可以使用。
一旦保存,标识无法修改。 field_multiple: 多重取值 setting_commit_cross_project_ref: 允许引用/修复所有其他项目的问题 text_issue_conflict_resolution_add_notes: 添加说明并取消我的其他变更处理。 diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index 52f3c65..ff291da 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -78,11 +78,11 @@ class RepositoriesGitControllerTest < ActionController::TestCase put :update, :id => repository.id, :repository => { :extra_report_last_commit => '0', - :identifier => 'test-update', + :identifier => 'cannot-be-changed-since-it-is-frozen', } assert_response 302 repo2 = Repository.find(repository.id) - assert_equal 'test-update', repo2.identifier + assert_equal 'test-create', repo2.identifier assert_equal false, repo2.extra_report_last_commit end diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb index bf17b88..5500e57 100644 --- a/test/unit/repository_test.rb +++ b/test/unit/repository_test.rb @@ -105,6 +105,22 @@ class RepositoryTest < ActiveSupport::TestCase ) assert r.save end + + def test_identifier_should_not_be_frozen_for_a_new_repository + assert_equal false, Repository.new.identifier_frozen? + end + + def test_identifier_should_not_be_frozen_for_a_saved_repository_with_blank_identifier + Repository.update_all(["identifier = ''"], "id = 10") + + assert_equal false, Repository.find(10).identifier_frozen? + end + + def test_identifier_should_be_frozen_for_a_saved_repository_with_valid_identifier + Repository.update_all(["identifier = 'abc123'"], "id = 10") + + assert_equal true, Repository.find(10).identifier_frozen? + end def test_destroy repository = Repository.find(10) -- 1.7.5.1