Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

Name the parent task in its error messages

Guido Boyke022fd2dbe441
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 6ce0e46..0a4310b 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -109,6 +109,7 @@ de:
created_at: Erstellt am
creator: Ersteller
number: Nummer
+ parent_id: Übergeordnete Aufgabe
project: Projekt
summary: Zusammenfassung
tags: Tags
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 31ede6c..461a52d 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -103,6 +103,7 @@ en:
created_at: Created at
creator: Creator
number: Number
+ parent_id: Parent task
project: Project
summary: Summary
tags: Tags
diff --git a/config/locales/models.de.yml b/config/locales/models.de.yml
index 7dfbd2c..266ae05 100644
--- a/config/locales/models.de.yml
+++ b/config/locales/models.de.yml
@@ -149,9 +149,9 @@ de:
ticket:
attributes:
parent_id:
- cannot_be_self: "darf nicht auf sich selbst verweisen"
- not_found: "übergeordnete Aufgabe nicht gefunden"
- different_project: "übergeordnete Aufgabe muss im selben Projekt liegen"
+ cannot_be_self: "darf nicht das Ticket selbst sein"
+ not_found: "wurde nicht gefunden"
+ different_project: "muss im selben Projekt liegen"
cannot_change: "kann nach dem Anlegen nicht mehr geändert werden"
reference:
self_reference: "Eine Referenz darf nicht auf sich selbst zeigen"
diff --git a/config/locales/models.en.yml b/config/locales/models.en.yml
index ec43596..fc2b491 100644
--- a/config/locales/models.en.yml
+++ b/config/locales/models.en.yml
@@ -141,9 +141,9 @@ en:
ticket:
attributes:
parent_id:
- cannot_be_self: "may not point to itself"
- not_found: "parent task not found"
- different_project: "parent task must be in the same project"
+ cannot_be_self: "cannot be the ticket itself"
+ not_found: "was not found"
+ different_project: "must be in the same project"
cannot_change: "cannot be changed once the ticket exists"
reference:
self_reference: "A reference may not point to itself"
diff --git a/spec/models/ticket_subtasks_spec.rb b/spec/models/ticket_subtasks_spec.rb
index 60d517d..dd78c82 100644
--- a/spec/models/ticket_subtasks_spec.rb
+++ b/spec/models/ticket_subtasks_spec.rb
@@ -128,6 +128,16 @@ RSpec.describe Ticket, 'sub-tasks', type: :model do
expect(b.reload.parent_id).to eq(a.id)
end
+ it 'names the parent task in the full message, in both languages' do
+ ticket = create(:ticket, project: project)
+ ticket.parent = create(:ticket, project: project)
+ ticket.valid?
+
+ full = ->(locale) { I18n.with_locale(locale) { ticket.errors.full_message(:parent_id, ticket.errors.generate_message(:parent_id, :cannot_change)) } }
+ expect(full.call(:de)).to eq('Übergeordnete Aufgabe kann nach dem Anlegen nicht mehr geändert werden')
+ expect(full.call(:en)).to eq('Parent task cannot be changed once the ticket exists')
+ end
+
it 'still saves other changes of a ticket with a parent' do
parent = create(:ticket, project: project)
child = create(:ticket, project: project, parent: parent)
diff --git a/spec/requests/organisations/tickets_subtasks_spec.rb b/spec/requests/organisations/tickets_subtasks_spec.rb
index e4465db..fe3066d 100644
--- a/spec/requests/organisations/tickets_subtasks_spec.rb
+++ b/spec/requests/organisations/tickets_subtasks_spec.rb
@@ -79,6 +79,8 @@ RSpec.describe 'Tickets sub-tasks (create)', :ci_guard, type: :request do
expect(response).to have_http_status(:found)
expect(flash[:notice]).to be_nil
expect(flash[:alert]).to include(cannot_change)
+ # The whole sentence a German reader sees: field name and message, both German.
+ expect(flash[:alert]).to include('Übergeordnete Aufgabe kann nach dem Anlegen nicht mehr geändert werden')
expect(parent_id_of(ticket)).to be_nil
end