-
Notifications
You must be signed in to change notification settings - Fork 369
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
Prevent duplicate list names in custom lists #6105
Prevent duplicate list names in custom lists #6105
Conversation
c283112
to
ecf69cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @rablador)
ios/MullvadSettings/CustomListRepository.swift
line 43 at r1 (raw file):
let persistedListWithSameName = lists.first { $0.name.localizedCaseInsensitiveCompare(list.name) == .orderedSame
do we really to compare the localized value
of a name? I'm of the opinion it's just a name regardless of its language.
ios/MullvadSettings/CustomListRepository.swift
line 46 at r1 (raw file):
} if let persistedListWithSameName, persistedListWithSameName.id != list.id {
nit : duplicatedName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @rablador)
ios/MullvadSettings/CustomListRepository.swift
line 46 at r1 (raw file):
Previously, mojganii wrote…
nit : duplicatedName
the name of class defines the object takes the responsibility of storing, having persisted
is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @mojganii)
ios/MullvadSettings/CustomListRepository.swift
line 43 at r1 (raw file):
Previously, mojganii wrote…
do we really to compare the
localized value
of a name? I'm of the opinion it's just a name regardless of its language.
Maybe you're right, I'll make a change.
ios/MullvadSettings/CustomListRepository.swift
line 46 at r1 (raw file):
Previously, mojganii wrote…
the name of class defines the object takes the responsibility of storing, having
persisted
is redundant.
It's the same variable, just that it's unwrapped here, just like guard let self else ...
.
I think it's good to distinguish where the two lists comes from. One is passed in to the function as param, the other is loaded from store. listWithSameName
feels a little too ambiguous for me.
ecf69cf
to
0f2b655
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @mojganii)
ios/MullvadSettings/CustomListRepository.swift
line 46 at r1 (raw file):
Previously, rablador (Jon Petersson) wrote…
It's the same variable, just that it's unwrapped here, just like
guard let self else ...
.I think it's good to distinguish where the two lists comes from. One is passed in to the function as param, the other is loaded from store.
listWithSameName
feels a little too ambiguous for me.
Did some refactoring to make it a little less obtuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mojganii)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all files reviewed, all discussions resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved
0f2b655
to
c3d575e
Compare
🚨 End to end tests failed. Please check the failed workflow run. |
It shouldn't be possible to save a custom list with an already existing list name.
This change is