Merge "Fix other users dashboards"

This commit is contained in:
Patrick Hiesel
2020-08-20 11:42:57 +00:00
committed by Gerrit Code Review
2 changed files with 12 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ public class IndexPreloadingUtil {
Pattern.compile(CHANGE_CANONICAL_URL + BASE_PATCH_NUM_URL_PART + "?" + "/?$");
public static final Pattern DIFF_URL_PATTERN =
Pattern.compile(CHANGE_CANONICAL_URL + BASE_PATCH_NUM_URL_PART + "(/(.+))" + "/?$");
public static final Pattern DASHBOARD_PATTERN = Pattern.compile(".*/dashboard/.+$");
public static final Pattern DASHBOARD_PATTERN = Pattern.compile(".*/dashboard/self$");
// These queries should be kept in sync with PolyGerrit:
// polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.ts

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.httpd.raw;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth8.assertThat;
import static com.google.gerrit.httpd.raw.IndexPreloadingUtil.computeChangeRequestsPath;
import static com.google.gerrit.httpd.raw.IndexPreloadingUtil.parseRequestedPage;
import com.google.gerrit.httpd.raw.IndexPreloadingUtil.RequestedPage;
import org.junit.Test;
@@ -47,4 +48,14 @@ public class IndexPreloadingUtilTest {
assertThat(computeChangeRequestsPath("/c/Scripts/+/232/1//COMMIT_MSG", RequestedPage.DIFF))
.hasValue("changes/Scripts~232");
}
@Test
public void preloadOnlyForSelfDashboard() throws Exception {
assertThat(parseRequestedPage("https://gerrit-review.googlesource.com/dashboard/self"))
.isEqualTo(RequestedPage.DASHBOARD);
assertThat(parseRequestedPage("https://gerrit-review.googlesource.com/dashboard/1085901"))
.isEqualTo(RequestedPage.PAGE_WITHOUT_PRELOADING);
assertThat(parseRequestedPage("https://gerrit-review.googlesource.com/dashboard/gerrit"))
.isEqualTo(RequestedPage.PAGE_WITHOUT_PRELOADING);
}
}