Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Fixup edit regressions introduced during edit/create refactor. #1133

Merged

Conversation

jhugman
Copy link
Contributor

@jhugman jhugman commented Jan 10, 2020

Fixes #1126
Fixes #1127

This fixes three bugs:

  • in the edit screen, the save button saved, but did not exit the screen. This is the root cause of all these bugs.
  • in the edit screen, the duplicate usernames were updated on save, and thence caused an error to be shown. This is irrelevant if the the save button now closes the edit screen.
  • when no hostname is shown (as in create) the usernames used to detect duplicates was all usernames for all hostnames. This is now prevented. This was unreported.

@jhugman jhugman requested a review from a team as a code owner January 10, 2020 14:59
Copy link
Contributor

@eliserichards eliserichards left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

.map { (opt, list) ->
val item = opt.value ?: return@map emptySet<String>()

val usernames = list
.filter(
hostname = item.hostname,
// Default to a blank space, otherwise we get all usernames for any hostname.
hostname = if (item.hostname.isNullOrBlank()) " " else item.hostname,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would the hostname ever be null/blank? This doesn't seem like a valid case to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hostname is blank in the case of Manual Create.

@jhugman jhugman merged commit ab09aeb into master Jan 13, 2020
@jhugman jhugman deleted the jhugman/1126-fixup-duplicat-username-error-on-save-in-edit branch January 13, 2020 16:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants