From 748e62f5fbdc13dd9f00932f68a89ce13e484cd2 Mon Sep 17 00:00:00 2001 From: Marthym Date: Sun, 25 Aug 2024 17:28:07 +0200 Subject: [PATCH] chore(main): #225 fix sonar issues --- .../infra/controllers/FeedController.java | 6 ++--- .../techwatch/infra/model/FeedForm.java | 4 +++- seaside/src/common/components/TagInput.vue | 3 +-- .../profile/ChangePasswordModal.vue | 10 ++++---- seaside/src/security/pages/LoginPage.vue | 24 +++++++++++-------- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/sandside/src/main/java/fr/ght1pc9kc/baywatch/techwatch/infra/controllers/FeedController.java b/sandside/src/main/java/fr/ght1pc9kc/baywatch/techwatch/infra/controllers/FeedController.java index 2d37d19a..e79809b0 100644 --- a/sandside/src/main/java/fr/ght1pc9kc/baywatch/techwatch/infra/controllers/FeedController.java +++ b/sandside/src/main/java/fr/ght1pc9kc/baywatch/techwatch/infra/controllers/FeedController.java @@ -131,7 +131,7 @@ public Mono> update(@PathVariable("id") String id, @Valid @Reque sink.next(Entity.identify(WebFeed.builder() .location(feedLocation) .description(ff.description()) - .tags(Set.of(ff.tags())) + .tags(Set.copyOf(ff.tags())) .name(ff.name()) .build()).withId(id)); }) @@ -143,7 +143,7 @@ public Mono> update(@PathVariable("id") String id, @Valid @Reque public Mono>> subscribe(@Valid @RequestBody Mono feedForm) { return feedForm.map(form -> { URI uri = URI.create(form.location()); - Set tags = Optional.ofNullable(form.tags()).map(Set::of).orElseGet(Set::of); + Set tags = Optional.ofNullable(form.tags()).map(Set::copyOf).orElseGet(Set::of); return Entity.identify(WebFeed.builder() .location(uri) .tags(tags) @@ -174,7 +174,7 @@ public Flux> importFeeds(@RequestBody @Valid Flux feed return Entity.identify(WebFeed.builder() .location(uri) .name(Optional.ofNullable(form.name()).orElseGet(uri::getHost)) - .tags(Set.of(form.tags())) + .tags(Set.copyOf(form.tags())) .build()) .withId(Hasher.identify(uri)); }).collectList() diff --git a/sandside/src/main/java/fr/ght1pc9kc/baywatch/techwatch/infra/model/FeedForm.java b/sandside/src/main/java/fr/ght1pc9kc/baywatch/techwatch/infra/model/FeedForm.java index 9d7e5057..8f62105f 100644 --- a/sandside/src/main/java/fr/ght1pc9kc/baywatch/techwatch/infra/model/FeedForm.java +++ b/sandside/src/main/java/fr/ght1pc9kc/baywatch/techwatch/infra/model/FeedForm.java @@ -3,10 +3,12 @@ import jakarta.validation.constraints.NotBlank; import org.hibernate.validator.constraints.URL; +import java.util.Set; + public record FeedForm( @NotBlank String name, @NotBlank @URL String location, String description, - String[] tags + Set tags ) { } diff --git a/seaside/src/common/components/TagInput.vue b/seaside/src/common/components/TagInput.vue index c0a65bea..070e34f1 100644 --- a/seaside/src/common/components/TagInput.vue +++ b/seaside/src/common/components/TagInput.vue @@ -14,8 +14,7 @@ class="input input-ghost input-xs w-32 flex-grow focus:outline-none placeholder:capitalize" type="text" @keydown="onKeydown">