diff --git a/src/main/java/org/eclipsefoundation/git/eca/resource/StatusResource.java b/src/main/java/org/eclipsefoundation/git/eca/resource/StatusResource.java index ceeeab0cb903ce06b8eb10c7ca48dcc5255ba482..2625fa163f4ef8edcebddaaa313e7d2f67f72dba 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/resource/StatusResource.java +++ b/src/main/java/org/eclipsefoundation/git/eca/resource/StatusResource.java @@ -120,7 +120,8 @@ public class StatusResource extends CommonResource { .entity(statusUiTemplate .data(COMMIT_STATUSES_PARAMETER, statuses) .data(PULL_REQUEST_NUMBER_PARAMETER, null) - .data("fullRepoName", null) + .data("repoName", null) + .data("orgName", null) .data("project", ps.isEmpty() ? null : ps.get(0)) .data(REPO_URL_PARAMETER, statuses.get(0).getRepoUrl()) .data("installationId", null) @@ -144,8 +145,6 @@ public class StatusResource extends CommonResource { @Path("gh/{org}/{repoName}/{prNo}") public Response getCommitValidationForGithub(@PathParam("org") String org, @PathParam("repoName") String repoName, @PathParam("prNo") Integer prNo) { - // get the repo full name, used in a few lookups - String repoFullName = org + '/' + repoName; // generate the URL used to retrieve valid projects String repoUrl = GithubValidationHelper.getRepoUrl(org, repoName); @@ -197,7 +196,8 @@ public class StatusResource extends CommonResource { .entity(statusUiTemplate .data(COMMIT_STATUSES_PARAMETER, statuses) .data(PULL_REQUEST_NUMBER_PARAMETER, prNo) - .data("fullRepoName", repoFullName) + .data("repoName", repoName) + .data("orgName", org) .data("project", ps.isEmpty() ? null : ps.get(0)) .data(REPO_URL_PARAMETER, repoUrl) .data("installationId", installationId) diff --git a/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultGithubApplicationService.java b/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultGithubApplicationService.java index b575f69c30b173414dc767f8638f4d7ead047378..02bbc0f38d58c4933d907eba327c2fcb9450e926 100644 --- a/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultGithubApplicationService.java +++ b/src/main/java/org/eclipsefoundation/git/eca/service/impl/DefaultGithubApplicationService.java @@ -119,8 +119,11 @@ public class DefaultGithubApplicationService implements GithubApplicationService @Override public Optional<PullRequest> getPullRequest(String installationId, String org, String repoName, Integer pullRequest) { String fullRepoName = GithubValidationHelper.getFullRepoName(org, repoName); + // create param map to better handle multiple PRs from a single repo in short time span + MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); + params.add(GitEcaParameterNames.PULL_REQUEST_NUMBER_RAW, Integer.toString(pullRequest)); return cache - .get(fullRepoName, new MultivaluedHashMap<>(), PullRequest.class, + .get(fullRepoName, params, PullRequest.class, () -> gh.getPullRequest(jwt.getGhBearerString(installationId), apiVersion, org, repoName, pullRequest)) .getData(); } diff --git a/src/main/resources/templates/simple_fingerprint_ui.html b/src/main/resources/templates/simple_fingerprint_ui.html index db83fc418a772773eedf23413d01e3a5121db44a..4bc08da854c4363359037871e75fb5216f360113 100644 --- a/src/main/resources/templates/simple_fingerprint_ui.html +++ b/src/main/resources/templates/simple_fingerprint_ui.html @@ -71,9 +71,9 @@ NO {/if} </li> - {#if fullRepoName ne null && pullRequestNumber ne null && statuses.0.provider == ProviderType:GITHUB} + {#if orgName ne null && repoName ne null && pullRequestNumber ne null && statuses.0.provider == ProviderType:GITHUB} <li> - <strong>Pull request:</strong> <a class="underline" href="https://github.com/{fullRepoName}/pull/{pullRequestNumber}" target="_blank" >#{pullRequestNumber}</a> + <strong>Pull request:</strong> <a class="underline" href="https://github.com/{orgName}/{repoName}/pull/{pullRequestNumber}" target="_blank" >#{pullRequestNumber}</a> </li> {/if} </ul> @@ -162,9 +162,9 @@ </div> </div> {/if} - {#if statuses.0.provider == ProviderType:GITHUB && pullRequestNumber != null && fullRepoName != null} + {#if statuses.0.provider == ProviderType:GITHUB && pullRequestNumber != null && repoName != null && orgName != null} <div> - <form id="git-eca-hook-revalidation" data-request-number="{pullRequestNumber}" data-request-repo="{fullRepoName}" data-request-installation="{installationId}"> + <form id="git-eca-hook-revalidation" data-request-number="{pullRequestNumber}" data-request-repo="{repoName}" data-request-org="{orgName}" data-request-installation="{installationId}"> <div class="captcha"> <div class="h-captcha" data-sitekey="{config:['eclipse.hcaptcha.site-key']}"></div> </div> @@ -302,7 +302,8 @@ $submitButton.attr("disabled", "disabled"); // set up params to set up for revalidation let params = $.param({ - repo_full_name: $form.data('request-repo'), + repo_name: $form.data('request-repo'), + org: $form.data('request-org'), pull_request_number: $form.data('request-number'), installation_id: $form.data('request-installation') });