Use Java record-style methods for accessing Scope The introduction of the Java 17 record type for Scope with I979fbfe27 has caused incompatiblity with the current Velocity templates because the fields are now accessible as methods. Adapt the Velocity template calls in scope.html to resume the current scopes selection functionality. Also create the missing getter for the Scope enum in OAuthProtocol for allowing Velocity to access it. Change-Id: I8f6e404c4a3f401deafa25061c1749028319e5b4
diff --git a/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java b/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java index 0ab686c..d3678c1 100644 --- a/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java +++ b/github-oauth/src/main/java/com/googlesource/gerrit/plugins/github/oauth/OAuthProtocol.java
@@ -146,6 +146,10 @@ this.value = value; this.description = description; } + + public String getDescription() { + return description; + } } private static final String ME_SEPARATOR = ",";
diff --git a/github-plugin/src/main/resources/static/scope.html b/github-plugin/src/main/resources/static/scope.html index ebc2580..f8d0546 100644 --- a/github-plugin/src/main/resources/static/scope.html +++ b/github-plugin/src/main/resources/static/scope.html
@@ -46,10 +46,10 @@ <ul class="scopes"> #foreach ( $scope in $scopes.keySet() ) <li> - #set ( $scopeName = $scope.name.substring(6) ) - #set ( $scopeDescription = $scope.description ) + #set ( $scopeName = $scope.name().substring(6) ) + #set ( $scopeDescription = $scope.description() ) #set ( $checked = "" ) - #if ( ( $scopeCookie && $scopeCookie == $scope.name ) || $scopeName == "" ) + #if ( ( $scopeCookie && $scopeCookie == $scope.name() ) || $scopeName == "" ) #set ( $checked = "checked" ) #end