From: Klaudio Sinani Date: Tue, 5 Jul 2022 11:22:53 +0000 (+0200) Subject: SONAR-16597 Ensure issues pull action returns issues data only for requested branch X-Git-Tag: 9.6.0.59041~275 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1b6d608b79fe592846ab4a52d149c07c0846ad56;p=sonarqube.git SONAR-16597 Ensure issues pull action returns issues data only for requested branch --- diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueQueryParams.java b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueQueryParams.java index bebf378b07c..0ce8683422b 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueQueryParams.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueQueryParams.java @@ -25,29 +25,23 @@ import javax.annotation.Nullable; public class IssueQueryParams { - private final String projectUuid; - private final String branchName; + private final String branchUuid; private final List languages; private final List ruleRepositories; private final boolean resolvedOnly; private final Long changedSince; - public IssueQueryParams(String projectUuid, String branchName, @Nullable List languages, + public IssueQueryParams(String branchUuid, @Nullable List languages, @Nullable List ruleRepositories, boolean resolvedOnly, @Nullable Long changedSince) { - this.projectUuid = projectUuid; - this.branchName = branchName; + this.branchUuid = branchUuid; this.languages = languages; this.ruleRepositories = ruleRepositories; this.resolvedOnly = resolvedOnly; this.changedSince = changedSince; } - public String getProjectUuid() { - return projectUuid; - } - - public String getBranchName() { - return branchName; + public String getBranchUuid() { + return branchUuid; } @CheckForNull diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml index 0b0690724ed..7cd7edc76f6 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/issue/IssueMapper.xml @@ -594,12 +594,10 @@ , p.path as filePath from issues i - inner join project_branches b on i.project_uuid = b.project_uuid inner join rules r on r.uuid = i.rule_uuid inner join components p on p.uuid=i.component_uuid where - b.kee = #{queryParams.branchName} - AND i.project_uuid = #{queryParams.projectUuid} + i.project_uuid = #{queryParams.branchUuid} AND i.issue_update_date >= #{queryParams.changedSince,jdbcType=BIGINT} @@ -635,11 +633,9 @@ row_number() over(order by i.kee ASC) as row_number, from issues i - inner join project_branches b on i.project_uuid = b.project_uuid inner join rules r on r.uuid = i.rule_uuid where - b.kee = #{queryParams.branchName} - AND i.project_uuid = #{queryParams.projectUuid} + i.project_uuid = #{queryParams.branchUuid} AND i.issue_update_date >= #{queryParams.changedSince,jdbcType=BIGINT} @@ -674,11 +670,9 @@ select from issues i - inner join project_branches b on i.project_uuid = b.project_uuid inner join rules r on r.uuid = i.rule_uuid where - b.kee = #{queryParams.branchName} - AND i.project_uuid = #{queryParams.projectUuid} + i.project_uuid = #{queryParams.branchUuid} AND i.issue_update_date >= #{queryParams.changedSince,jdbcType=BIGINT} @@ -711,12 +705,10 @@