From 6fcb1de63af7fa820cd321ce83c6c9ec8af51eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= Date: Sat, 29 Oct 2011 18:29:18 +0200 Subject: [PATCH] Graciously handle deleted custom fields on issue history view. --- config/locales/de.yml | 1 + config/locales/en.yml | 1 + config/locales/fr.yml | 1 + test/integration/issues_test.rb | 5 +++++ .../acts_as_journalized/lib/journal_formatter.rb | 12 +++++++++--- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index 322455df..37795e51 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -798,6 +798,7 @@ de: label_project_copy_notifications: Sende Mailbenachrichtigungen beim Kopieren des Projekts. label_principal_search: "Nach Benutzer oder Gruppe suchen:" label_user_search: "Nach Benutzer suchen:" + label_deleted_custom_field: '(gelöschtes benutzerdefiniertes Feld)' button_login: Anmelden button_submit: OK diff --git a/config/locales/en.yml b/config/locales/en.yml index 547d22aa..7dc63957 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -812,6 +812,7 @@ en: label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author label_notify_member_plural: Email issue updates label_path_encoding: Path encoding + label_deleted_custom_field: '(deleted custom field)' button_login: Login button_submit: Submit diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 53d6f09a..5f8d8317 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -793,6 +793,7 @@ fr: label_user_search: "Rechercher un utilisateur :" label_additional_workflow_transitions_for_author: Autorisations supplémentaires lorsque l'utilisateur a créé la demande label_additional_workflow_transitions_for_assignee: Autorisations supplémentaires lorsque la demande est assignée à l'utilisateur + label_deleted_custom_field: '(champ personnalisé supprimé)' button_login: Connexion button_submit: Soumettre diff --git a/test/integration/issues_test.rb b/test/integration/issues_test.rb index 9c22313f..5e0ee771 100644 --- a/test/integration/issues_test.rb +++ b/test/integration/issues_test.rb @@ -199,5 +199,10 @@ class IssuesTest < ActionController::IntegrationTest :content => new_tester.name } } + + # Test for deleted custom field handling + @field.destroy + get "/issues/#{issue.id}" + assert_response :success end end diff --git a/vendor/plugins/acts_as_journalized/lib/journal_formatter.rb b/vendor/plugins/acts_as_journalized/lib/journal_formatter.rb index 02953e3b..fc8ad92b 100644 --- a/vendor/plugins/acts_as_journalized/lib/journal_formatter.rb +++ b/vendor/plugins/acts_as_journalized/lib/journal_formatter.rb @@ -83,9 +83,15 @@ module JournalFormatter end def format_custom_value_detail(custom_field, values, no_html) - label = custom_field.name - old_value = format_value(values.first, custom_field.field_format) if values.first - value = format_value(values.last, custom_field.field_format) if values.last + if custom_field + label = custom_field.name + old_value = format_value(values.first, custom_field.field_format) if values.first + value = format_value(values.last, custom_field.field_format) if values.last + else + label = l(:label_deleted_custom_field) + old_value = values.first + value = values.last + end [label, old_value, value] end