switch to server-only ID length validation

This commit is contained in:
Tomas Hykel
2026-03-16 21:08:23 +01:00
parent 7027cb5734
commit 42c79fe19a
2 changed files with 2 additions and 4 deletions
@@ -37,7 +37,6 @@ module Projects
label: attribute_name(:identifier),
caption: I18n.t("projects.settings.change_identifier_format_hint_semantic"),
required: true,
maxlength: Project::SEMANTIC_IDENTIFIER_MAX_LENGTH,
validation_message: validation_message_for(:identifier)
)
else
@@ -46,7 +45,6 @@ module Projects
label: attribute_name(:identifier),
caption: I18n.t("projects.settings.change_identifier_format_hint_legacy"),
required: true,
maxlength: Project::IDENTIFIER_MAX_LENGTH,
validation_message: validation_message_for(:identifier)
)
end
@@ -55,7 +53,7 @@ module Projects
private
def validation_message_for(attribute)
model.errors.messages_for(attribute).to_sentence.presence
model.errors.full_messages_for(attribute).to_sentence.presence
end
end
end
@@ -51,7 +51,7 @@ RSpec.describe Projects::IdentifierController do
put :update, params: { project_id: project.id, project: { identifier: "bad identifier" }, format: :turbo_stream }
expect(response).to have_http_status(:unprocessable_entity)
expect(response.body).to include("is invalid")
expect(response.body).to include("Identifier is invalid")
expect(project.reload.identifier).to eq(previous_identifier)
end
end