From 2a718cb91427aeb3ddb0adb35c15f81cee18461f Mon Sep 17 00:00:00 2001 From: =?utf8?q?L=C3=A9o=20Geoffroy?= Date: Thu, 1 Jun 2023 10:30:02 +0200 Subject: [PATCH] SONAR-18856 Fix code smells and TODOs --- .../migration/version/v101/PopulateReportSubscriptions.java | 2 +- .../main/java/org/sonar/server/user/ServerUserSession.java | 2 +- .../java/org/sonar/server/component/ComponentUpdater.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptions.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptions.java index 63b197577ce..12bfa4d129f 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptions.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptions.java @@ -26,7 +26,7 @@ import org.sonar.server.platform.db.migration.step.DataChange; import org.sonar.server.platform.db.migration.step.MassUpdate; public class PopulateReportSubscriptions extends DataChange { - // TODO should we add a inner join on users to not transfer values of non-existent users? + private static final String SELECT_QUERY = """ SELECT port.uuid as portfolioUuid, pb.uuid as branchUuid, p.user_uuid as userUuid FROM properties p diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java index 518b710e5f4..dfabf778740 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/ServerUserSession.java @@ -199,7 +199,7 @@ public class ServerUserSession extends AbstractUserSession { @Override public List keepAuthorizedEntities(String permission, Collection projects) { Set projectsUuids = projects.stream().map(EntityDto::getUuid).collect(Collectors.toSet()); - // TODO + // TODO in SONAR-19445 Set authorizedProjectsUuids = keepProjectsUuidsByPermission(permission, projectsUuids); return projects.stream() diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java index bf4136b08a1..c905660861a 100644 --- a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ComponentUpdater.java @@ -150,12 +150,12 @@ public class ComponentUpdater { dbClient.portfolioDao().insert(dbSession, portfolioDto); } - // TODO permissions: probably we want to apply it to the projectDto or portfolioDto + // TODO SONAR-19445: probably we want to apply it to the projectDto or portfolioDto permissionTemplateService.applyDefaultToNewComponent(dbSession, componentDto, userUuid); return new ComponentCreationData(componentDto, mainBranch, projectDto); } - // TODO, when working on permissions, maybe we could remove the last argument from this method + // TODO SONAR-19445, when working on permissions, maybe we could remove the last argument from this method private void addToFavourites(DbSession dbSession, ProjectDto projectDto, @Nullable String userUuid, @Nullable String userLogin, ComponentDto componentDto) { if (permissionTemplateService.hasDefaultTemplateWithPermissionOnProjectCreator(dbSession, componentDto)) { favoriteUpdater.add(dbSession, projectDto, userUuid, userLogin, false); -- 2.39.5