Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #20133: Technique editor allows id with only case difference, do an error, but still save technique #4079

Conversation

ElaadF
Copy link
Member

@ElaadF ElaadF commented Dec 30, 2021

@ElaadF
Copy link
Member Author

ElaadF commented Dec 30, 2021

PR updated with a new commit

@ElaadF
Copy link
Member Author

ElaadF commented Dec 30, 2021

PR updated with a new commit

@ElaadF ElaadF force-pushed the bug_20133/technique_editor_allows_id_with_only_case_difference_do_an_error_but_still_save_technique branch from 4a4765d to 8f171e6 Compare December 30, 2021 10:38
val techniques = techniqueRepository.getAll()
techniques.keySet.map(_.name.value).contains(bundleName.value)
techniques.values.map(_.name.toLowerCase).toList.contains(techniqueName.toLowerCase)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need the toList ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

techniques.values produce Iterable[Technique] and contains do not apply on Iterable[A]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should advertise in the comment (at least) that it's a case insensitive comparision

isNameTaken = isTechniqueNameExist(technique.name)
isIdTaken = isTechniqueIdExist(technique.bundleName)
_ <- (isNameTaken, isIdTaken) match {
case (true, true) => Failure(s"Technique name and ID must be unique. Name '${technique.name}' and ID '${technique.bundleName.value}' already used")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error message should state that the comparision is case insensitive

@ElaadF
Copy link
Member Author

ElaadF commented Jan 3, 2022

PR updated with a new commit

@ElaadF ElaadF requested a review from ncharles January 3, 2022 11:22
@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/4079
-- Your faithful QA
Kant merge: "It is beyond a doubt that all our knowledge begins with experience."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/49076/console)

@ElaadF
Copy link
Member Author

ElaadF commented Jan 5, 2022

OK, squash merging this PR

@ElaadF ElaadF force-pushed the bug_20133/technique_editor_allows_id_with_only_case_difference_do_an_error_but_still_save_technique branch from 8a9b9a3 to 196ae97 Compare January 5, 2022 09:03
@ElaadF ElaadF merged commit 196ae97 into Normation:branches/rudder/7.0 Jan 5, 2022
@ElaadF ElaadF self-assigned this Jan 5, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants