Merge branch 'stable-3.1' into stable-3.2

* stable-3.1:
  Remove documentation of obsolete gerrit.canLoadInIFrame
  Remove obsolete HostPage.html
  IndexHtmlUtil: Don't log full stack trace when user is not authenticated
  Schema: Show only a single log for inexistent commits
  Schema: Refactor lambda in buildFields to a separate function
  ProjectJson: Use merge function for label value rendering

Change-Id: If912b2c38e2e3baaa58aa13969e8dc942204aeb3
This commit is contained in:
Marco Miller
2020-06-15 11:18:05 -04:00
4 changed files with 14 additions and 36 deletions

View File

@@ -2208,13 +2208,6 @@ file containing the class must be placed in the `$site_path/lib` folder.
+
If not specified, the default no-op implementation is used.
[[gerrit.canLoadInIFrame]]gerrit.canLoadInIFrame::
+
For security reasons Gerrit will always jump out of iframe.
Setting this option to true will prevent this behavior.
+
By default false.
[[gerrit.cdnPath]]gerrit.cdnPath::
+
Path prefix for PolyGerrit's static resources if using a CDN.

View File

@@ -153,8 +153,7 @@ public class IndexHtmlUtil {
serializeObject(GSON, accountApi.getEditPreferences()));
data.put("userIsAuthenticated", true);
} catch (AuthException e) {
logger.atFine().withCause(e).log(
"Can't inline account-related data because user is unauthenticated");
logger.atFine().log("Can't inline account-related data because user is unauthenticated");
// Don't render data
}

View File

@@ -18,6 +18,7 @@ import static java.util.stream.Collectors.toMap;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelValue;
import com.google.gerrit.entities.Project;
@@ -34,6 +35,7 @@ import java.util.HashMap;
/** Collection of routines to populate {@link ProjectInfo}. */
@Singleton
public class ProjectJson {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private final AllProjectsName allProjects;
private final WebLinks webLinks;
@@ -50,7 +52,17 @@ public class ProjectJson {
for (LabelType t : projectState.getLabelTypes().getLabelTypes()) {
LabelTypeInfo labelInfo = new LabelTypeInfo();
labelInfo.values =
t.getValues().stream().collect(toMap(LabelValue::formatValue, LabelValue::getText));
t.getValues().stream()
.collect(
toMap(
LabelValue::formatValue,
LabelValue::getText,
(v1, v2) -> {
logger.atSevere().log(
"Duplicate values for project: %s, label: %s found: '%s':'%s'",
projectState.getName(), t.getName(), v1, v2);
return v1;
}));
labelInfo.defaultValue = t.getDefaultValue();
info.labels.put(t.getName(), labelInfo);
}

View File

@@ -1,26 +0,0 @@
<html>
<head>
<title>Gerrit Code Review</title>
<meta name="gwt:property" content="locale=en_US" />
<script id="gerrit_hostpagedata"></script>
<style id="gerrit_sitecss" type="text/css"></style>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
</head>
<body>
<div id="gerrit_topmenu"></div>
<div id="gerrit_header"></div>
<div id="gerrit_startinggerrit" style="margin-left: 10px;">
<p>Loading <a href="https://www.gerritcodereview.com/" target="_blank">Gerrit Code Review</a> ...</p>
<noscript>
<p>Gerrit requires a JavaScript enabled browser.</p>
</noscript>
</div>
<div id="gerrit_body"></div>
<div style="clear: both">
<div id="gerrit_footer"></div>
<div id="gerrit_btmmenu"></div>
</div>
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
<script id="gerrit_module"></script>
</body>
</html>