mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
switch to server-only ID length validation
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user