diff --git a/cesium-plus-pod-assembly/pom.xml b/cesium-plus-pod-assembly/pom.xml
index f6663b7b..e1aedde9 100644
--- a/cesium-plus-pod-assembly/pom.xml
+++ b/cesium-plus-pod-assembly/pom.xml
@@ -4,7 +4,7 @@
org.duniter.cesium
cesium-plus-pod
- 1.10.7
+ 1.10.8
cesium-plus-pod-assembly
diff --git a/cesium-plus-pod-client/pom.xml b/cesium-plus-pod-client/pom.xml
index dfdc1bde..2b031873 100644
--- a/cesium-plus-pod-client/pom.xml
+++ b/cesium-plus-pod-client/pom.xml
@@ -4,7 +4,7 @@
org.duniter.cesium
cesium-plus-pod
- 1.10.7
+ 1.10.8
cesium-plus-pod-client
diff --git a/cesium-plus-pod-core/pom.xml b/cesium-plus-pod-core/pom.xml
index 9ed354aa..3d473e43 100644
--- a/cesium-plus-pod-core/pom.xml
+++ b/cesium-plus-pod-core/pom.xml
@@ -4,7 +4,7 @@
org.duniter.cesium
cesium-plus-pod
- 1.10.7
+ 1.10.8
cesium-plus-pod-core
diff --git a/cesium-plus-pod-core/src/main/java/org/duniter/elasticsearch/service/WotService.java b/cesium-plus-pod-core/src/main/java/org/duniter/elasticsearch/service/WotService.java
index 44298834..cb31fbd0 100644
--- a/cesium-plus-pod-core/src/main/java/org/duniter/elasticsearch/service/WotService.java
+++ b/cesium-plus-pod-core/src/main/java/org/duniter/elasticsearch/service/WotService.java
@@ -24,9 +24,11 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
+import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.mutable.MutableInt;
import org.duniter.core.client.model.bma.BlockchainParameters;
import org.duniter.core.client.model.bma.WotRequirements;
+import org.duniter.core.client.model.local.Identity;
import org.duniter.core.client.model.local.Member;
import org.duniter.core.client.repositories.CurrencyRepository;
import org.duniter.core.client.service.bma.WotRemoteService;
@@ -217,53 +219,78 @@ public void onChange(ChangeEvent change) {
}
public boolean isOrWasMember(String pubkey) {
+ return Beans.getStream(currencyRepository.findAllIds())
+ .anyMatch(currencyId -> this.isOrWasMember(currencyId, pubkey));
+ }
-
- String[] currencyIds = Beans.getStream(currencyRepository.findAllIds()).toArray(String[]::new);
- if (ArrayUtils.isEmpty(currencyIds)) return false;
+ public boolean isOrWasMember(String currency, String pubkey) {
+ final String currencyId = safeGetCurrency(currency);
+ if (StringUtils.isBlank(currencyId)) return false;
SearchResponse response = client.prepareSearch()
- .setIndices(currencyIds)
- .setSize(0) // only need the total
- .setTypes(MemberRepository.TYPE)
- .setQuery(QueryBuilders.idsQuery().ids(pubkey))
- .setRequestCache(true)
- .execute().actionGet();
+ .setIndices(currencyId)
+ .setSize(0) // only need the total
+ .setTypes(MemberRepository.TYPE)
+ .setQuery(QueryBuilders.idsQuery().ids(pubkey))
+ .setRequestCache(true)
+ .execute().actionGet();
return response.getHits() != null && response.getHits().getTotalHits() > 0;
}
public boolean isMember(String pubkey) {
+ return Beans.getStream(currencyRepository.findAllIds())
+ .anyMatch(currencyId -> this.isMember(currencyId, pubkey));
+ }
- String[] currencyIds = Beans.getStream(currencyRepository.findAllIds()).toArray(String[]::new);
- if (ArrayUtils.isEmpty(currencyIds)) return false;
+ public boolean isMember(String currency, String pubkey) {
+
+ final String currencyId = safeGetCurrency(currency);
QueryBuilder query = QueryBuilders.constantScoreQuery(QueryBuilders.boolQuery()
- .filter(QueryBuilders.idsQuery().addIds(pubkey))
- .filter(QueryBuilders.termQuery(Member.Fields.IS_MEMBER, true))
+ .filter(QueryBuilders.idsQuery().addIds(pubkey))
+ .filter(QueryBuilders.termQuery(Member.Fields.IS_MEMBER, true))
);
SearchResponse response = client.prepareSearch()
- .setIndices(currencyIds)
- .setSize(0) // only need the total
- .setTypes(MemberRepository.TYPE)
- .setQuery(query)
- .setRequestCache(true)
- .execute().actionGet();
+ .setIndices(currencyId)
+ .setSize(0) // only need the total
+ .setTypes(MemberRepository.TYPE)
+ .setQuery(query)
+ .setRequestCache(true)
+ .execute().actionGet();
return response.getHits() != null && response.getHits().getTotalHits() > 0;
}
public List getRequirements(String currency, String pubkey) {
waitReady();
-
final String currencyId = safeGetCurrency(currency);
-
return this.wotRemoteService.getRequirements(currencyId, pubkey);
}
- public Optional getMemberByPubkey(String currencyId, String pubkey) {
- return this.memberRepository.getMemberByPubkey(currencyId, pubkey);
+ public Optional getMemberByPubkey(String currency, String pubkey) {
+ final String currencyId = safeGetCurrency(currency);
+
+ if (isBlockchainReady(currencyId)) {
+ return this.memberRepository.getMemberByPubkey(currencyId, 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);
+ }
}
/* -- protected methods -- */
diff --git a/cesium-plus-pod-model/pom.xml b/cesium-plus-pod-model/pom.xml
index f8c9c3f8..6fe64041 100644
--- a/cesium-plus-pod-model/pom.xml
+++ b/cesium-plus-pod-model/pom.xml
@@ -4,7 +4,7 @@
org.duniter.cesium
cesium-plus-pod
- 1.10.7
+ 1.10.8
cesium-plus-pod-model
diff --git a/cesium-plus-pod-subscription/pom.xml b/cesium-plus-pod-subscription/pom.xml
index 4cf0b45f..7a212a34 100644
--- a/cesium-plus-pod-subscription/pom.xml
+++ b/cesium-plus-pod-subscription/pom.xml
@@ -4,7 +4,7 @@
org.duniter.cesium
cesium-plus-pod
- 1.10.7
+ 1.10.8
cesium-plus-pod-subscription
diff --git a/cesium-plus-pod-test/pom.xml b/cesium-plus-pod-test/pom.xml
index 5bca7644..4d672e63 100644
--- a/cesium-plus-pod-test/pom.xml
+++ b/cesium-plus-pod-test/pom.xml
@@ -3,7 +3,7 @@
org.duniter.cesium
cesium-plus-pod
- 1.10.7
+ 1.10.8
4.0.0
diff --git a/cesium-plus-pod-user/pom.xml b/cesium-plus-pod-user/pom.xml
index cb08d017..e72357ee 100644
--- a/cesium-plus-pod-user/pom.xml
+++ b/cesium-plus-pod-user/pom.xml
@@ -3,7 +3,7 @@
cesium-plus-pod
org.duniter.cesium
- 1.10.7
+ 1.10.8
4.0.0
diff --git a/pom.xml b/pom.xml
index 34dde6c0..74e31d98 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
org.duniter.cesium
cesium-plus-pod
- 1.10.7
+ 1.10.8
pom
Cesium+ pod
Cesium+ pod :: An ElasticSearch cluster for Duniter network
@@ -20,13 +20,12 @@
+
UTF-8
UTF-8
11
- java18
- 1.0
1.5.10
@@ -109,7 +108,7 @@
fr_FR,en_GB
true
-
+
${basedir}/src
@@ -475,8 +474,7 @@
org.codehaus.mojo
exec-maven-plugin
- 1.5.0
-
+ ${execPluginVersion}
diff --git a/src/scripts/release-to-github.sh b/src/scripts/release-to-github.sh
index b17d8943..430570fa 100755
--- a/src/scripts/release-to-github.sh
+++ b/src/scripts/release-to-github.sh
@@ -112,7 +112,7 @@ case "$task" in
result=$(curl -s -H ''"$GITHUT_AUTH"'' -H 'Content-Type: application/zip' -T "${ZIP_FILE}" "${upload_url}?name=${ZIP_BASENAME}")
browser_download_url=`echo "$result" | grep -P "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "\"browser_download_url\":[ ]?\"[^\"]+" | grep -oP "https://[A-Za-z0-9/.-]+"`
ZIP_SHA256=$(sha256sum "${ZIP_FILE}" | sed 's/ /\n/gi' | head -n 1)
- echo " - $browser_download_url | SHA256: ${SHA256}"
+ echo " - $browser_download_url | SHA256: ${ZIP_SHA256}"
# Send Checksum file
SHA_BASENAME=${ZIP_BASENAME}.sha256
diff --git a/src/scripts/release.sh b/src/scripts/release.sh
index 43c26767..c934641f 100755
--- a/src/scripts/release.sh
+++ b/src/scripts/release.sh
@@ -69,7 +69,7 @@ echo ""
echo "---- Removing local release branch ..."
echo ""
git branch -d "release/$version"
-# NOTE: can fail, but continu
+# NOTE: can fail, but continue
echo "---- Uploading artifacts to Github..."
echo ""