Skip to content

Commit

Permalink
Merge branch 'release/1.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
blavenie committed Sep 15, 2023
2 parents f0c6ddc + c0094b3 commit 07a5a6e
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 26 deletions.
2 changes: 1 addition & 1 deletion cesium-plus-pod-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.10.8</version>
<version>1.11.0</version>
</parent>

<artifactId>cesium-plus-pod-assembly</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cesium-plus-pod-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.10.8</version>
<version>1.11.0</version>
</parent>

<artifactId>cesium-plus-pod-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cesium-plus-pod-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.10.8</version>
<version>1.11.0</version>
</parent>

<artifactId>cesium-plus-pod-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void handleRequest(RestRequest request, RestChannel channel, Client cl
String pubkey = request.param("pubkey");

try {
List<WotRequirements> requirements = wotService.getRequirements(currency, pubkey);
List<WotRequirements> requirements = wotService.getRequirementsByPubkey(currency, pubkey);
if (requirements == null) {
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request).startObject()
.field("ucode", 2021)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ protected XContentBuilder getMembershipWithRequirements(Peer peer,
do {

try {
identities = wotRemoteService.getRequirements(peer, membership.getPubkey());
identities = wotRemoteService.getRequirementsByPubkey(peer, membership.getPubkey());
requestCounter.increment();
}
// Error can occur because of quota on BMA api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,16 @@ public boolean isMember(String currency, String pubkey) {
return response.getHits() != null && response.getHits().getTotalHits() > 0;
}

public List<WotRequirements> getRequirements(String currency, String pubkey) {
public List<WotRequirements> getRequirements(String currency, String uidOrPubkey) {
waitReady();
final String currencyId = safeGetCurrency(currency);
return this.wotRemoteService.getRequirements(currencyId, pubkey);
return this.wotRemoteService.getRequirements(currencyId, uidOrPubkey);
}

public List<WotRequirements> getRequirementsByPubkey(String currency, String pubkey) {
waitReady();
final String currencyId = safeGetCurrency(currency);
return this.wotRemoteService.getRequirementsByPubkey(currencyId, pubkey);
}

public Optional<Member> getMemberByPubkey(String currency, String pubkey) {
Expand All @@ -277,19 +283,25 @@ public Optional<Member> getMemberByPubkey(String currency, String pubkey) {
}
// Fallback to remote duniter node (e.g. Blockchain not yet indexed)
else {
Identity source = this.wotRemoteService.getIdentity(currencyId, pubkey);
if (source == null
|| !currencyId.equals(source.getCurrency())
|| (!source.getIsMember() && source.getWasMember())) return Optional.empty(); // Not a member

Member target = new Member();
target.setPubkey(pubkey);
target.setCurrency(currencyId);
target.setUid(source.getUid());
target.setIsMember(source.getIsMember());
target.setWasMember(source.getWasMember());
target.setTimestamp(source.getTimestamp());
return Optional.of(target);
return this.wotRemoteService.getRequirementsByPubkey(currencyId, pubkey)
.stream()
.map(source -> {
Member target = new Member();
target.setPubkey(pubkey);
target.setCurrency(currencyId);
target.setUid(source.getUid());
target.setWasMember(source.getWasMember());
Boolean isMember = Boolean.FALSE.equals(source.getRevoked())
&& source.getMembershipExpiresIn() != null
&& source.getMembershipExpiresIn() > 0;
target.setIsMember(isMember);
if (source.getMeta() != null) {
target.setTimestamp(source.getMeta().getTimestamp());
}
return target;
})
.filter(source -> Boolean.TRUE.equals(source.getWasMember()) || source.getIsMember())
.findFirst();
}
}

Expand Down
2 changes: 1 addition & 1 deletion cesium-plus-pod-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.10.8</version>
<version>1.11.0</version>
</parent>

<artifactId>cesium-plus-pod-model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cesium-plus-pod-subscription/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.10.8</version>
<version>1.11.0</version>
</parent>

<artifactId>cesium-plus-pod-subscription</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cesium-plus-pod-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.10.8</version>
<version>1.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion cesium-plus-pod-user/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>cesium-plus-pod</artifactId>
<groupId>org.duniter.cesium</groupId>
<version>1.10.8</version>
<version>1.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.duniter.cesium</groupId>
<artifactId>cesium-plus-pod</artifactId>
<version>1.10.8</version>
<version>1.11.0</version>
<packaging>pom</packaging>
<name>Cesium+ pod</name>
<description>Cesium+ pod :: An ElasticSearch cluster for Duniter network</description>
Expand All @@ -28,7 +28,7 @@
<javaVersion>11</javaVersion>

<!-- Commons versions -->
<duniter4j.version>1.5.10</duniter4j.version>
<duniter4j.version>1.6.1</duniter4j.version>
<log4j.version>1.2.17</log4j.version>
<slf4j.version>1.7.6</slf4j.version>
<guava.version>22.0</guava.version>
Expand Down

0 comments on commit 07a5a6e

Please sign in to comment.