Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

improve error message for non-existing filter

Christophe Bliard4ace588f3a7c
diff --git a/app/models/queries/filters/not_existing_filter.rb b/app/models/queries/filters/not_existing_filter.rb
index f3c7b3e6186..b84a41c01f7 100644
--- a/app/models/queries/filters/not_existing_filter.rb
+++ b/app/models/queries/filters/not_existing_filter.rb
@@ -48,7 +48,7 @@ module Queries
validate :always_false
def always_false
- errors.add :base, I18n.t(:'activerecord.errors.messages.does_not_exist')
+ errors.add :base, I18n.t(:'activerecord.errors.messages.filter_does_not_exist')
end
# deactivating superclass validation
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 10d417cfdc3..01b16f041b3 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -624,6 +624,7 @@ en:
even: "must be even."
exclusion: "is reserved."
file_too_large: "is too large (maximum size is %{count} Bytes)."
+ filter_does_not_exist: "filter does not exist."
format: "does not match the expected format '%{expected}'."
format_nested: "does not match the expected format '%{expected}' at path '%{path}'."
greater_than: "must be greater than %{count}."
diff --git a/spec/models/queries/notifications/notification_query_spec.rb b/spec/models/queries/notifications/notification_query_spec.rb
index 15ebcc52c14..58b8fba398c 100644
--- a/spec/models/queries/notifications/notification_query_spec.rb
+++ b/spec/models/queries/notifications/notification_query_spec.rb
@@ -95,7 +95,7 @@ describe Queries::Notifications::NotificationQuery, type: :model do
it 'returns the error on the filter' do
instance.valid?
- expect(instance.errors[:filters]).to eql ["Not supposed to exist does not exist."]
+ expect(instance.errors[:filters]).to eql ["Not supposed to exist filter does not exist."]
end
end
end
diff --git a/spec/models/queries/placeholder_users/placeholder_user_query_spec.rb b/spec/models/queries/placeholder_users/placeholder_user_query_spec.rb
index 1972813aeff..95080fb0b5f 100644
--- a/spec/models/queries/placeholder_users/placeholder_user_query_spec.rb
+++ b/spec/models/queries/placeholder_users/placeholder_user_query_spec.rb
@@ -126,7 +126,7 @@ describe Queries::PlaceholderUsers::PlaceholderUserQuery, type: :model do
it 'returns the error on the filter' do
instance.valid?
- expect(instance.errors[:filters]).to eql ["Not supposed to exist does not exist."]
+ expect(instance.errors[:filters]).to eql ["Not supposed to exist filter does not exist."]
end
end
end
diff --git a/spec/models/queries/users/user_query_spec.rb b/spec/models/queries/users/user_query_spec.rb
index a5dfeab9c20..4250795631f 100644
--- a/spec/models/queries/users/user_query_spec.rb
+++ b/spec/models/queries/users/user_query_spec.rb
@@ -153,7 +153,7 @@ describe Queries::Users::UserQuery, type: :model do
it 'returns the error on the filter' do
instance.valid?
- expect(instance.errors[:filters]).to eql ["Not supposed to exist does not exist."]
+ expect(instance.errors[:filters]).to eql ["Not supposed to exist filter does not exist."]
end
end
end
diff --git a/spec/requests/api/v3/queries/create_form_api_spec.rb b/spec/requests/api/v3/queries/create_form_api_spec.rb
index f4a231bdb16..2f5265af050 100644
--- a/spec/requests/api/v3/queries/create_form_api_spec.rb
+++ b/spec/requests/api/v3/queries/create_form_api_spec.rb
@@ -499,7 +499,7 @@ describe "POST /api/v3/queries/form", type: :request do
end
it "returns a validation error" do
- expect(form.dig("_embedded", "validationErrors", "base", "message")).to eq "Statuz does not exist."
+ expect(form.dig("_embedded", "validationErrors", "base", "message")).to eq "Statuz filter does not exist."
end
it "has no commit link" do
diff --git a/spec/requests/api/v3/queries/create_query_spec.rb b/spec/requests/api/v3/queries/create_query_spec.rb
index ab8a117b9ef..c23740cec16 100644
--- a/spec/requests/api/v3/queries/create_query_spec.rb
+++ b/spec/requests/api/v3/queries/create_query_spec.rb
@@ -166,7 +166,7 @@ describe "POST /api/v3/queries", type: :request do
post!
expect(last_response.status).to eq 422
- expect(json["message"]).to eq "Statuz does not exist."
+ expect(json["message"]).to eq "Statuz filter does not exist."
end
end
end
diff --git a/spec/requests/api/v3/queries/update_form_api_spec.rb b/spec/requests/api/v3/queries/update_form_api_spec.rb
index c4942089f32..856e746cfc9 100644
--- a/spec/requests/api/v3/queries/update_form_api_spec.rb
+++ b/spec/requests/api/v3/queries/update_form_api_spec.rb
@@ -460,7 +460,7 @@ describe "POST /api/v3/queries/form", type: :request do
end
it "returns a validation error" do
- expect(form.dig("_embedded", "validationErrors", "base", "message")).to eq "Statuz does not exist."
+ expect(form.dig("_embedded", "validationErrors", "base", "message")).to eq "Statuz filter does not exist."
end
it "has no commit link" do
diff --git a/spec/requests/api/v3/queries/update_query_spec.rb b/spec/requests/api/v3/queries/update_query_spec.rb
index 8a50937442e..2146a2f43a4 100644
--- a/spec/requests/api/v3/queries/update_query_spec.rb
+++ b/spec/requests/api/v3/queries/update_query_spec.rb
@@ -189,7 +189,7 @@ describe "PATCH /api/v3/queries/:id", type: :request do
post!
expect(last_response.status).to eq 422
- expect(json["message"]).to eq "Statuz does not exist."
+ expect(json["message"]).to eq "Statuz filter does not exist."
end
end
end