Skip to content

Commit d36f6d6

Browse files
committed
- fix #184 - Wot/ last registration were not displsayed, when an user has more than ONE membership doc
- Join: more precise message (too long, too short value)
1 parent 577cb39 commit d36f6d6

File tree

7 files changed

+43
-40
lines changed

7 files changed

+43
-40
lines changed

scss/ionic.app.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ $ionicon-var-badge-editable: $ionicon-var-edit + "\00a0";
11821182
Help Tip
11831183
**********/
11841184
.popover-helptip {
1185-
background-color:rgba(68, 68, 68, 0.85);
1185+
background-color:rgba(68, 68, 68, 0.85) !important;
11861186
height: auto !important;
11871187
}
11881188

www/css/ionic.app.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13796,7 +13796,7 @@ a {
1379613796
Help Tip
1379713797
**********/
1379813798
.popover-helptip {
13799-
background-color: rgba(68, 68, 68, 0.85);
13799+
background-color: rgba(68, 68, 68, 0.85) !important;
1380013800
height: auto !important; }
1380113801

1380213802
/**********

www/css/ionic.app.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

www/i18n/locale-fr-FR.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"ENABLE": "Activé",
4545
"DISABLE": "Désactivé",
4646
"RESULTS_LIST": "Résultats :",
47-
"SHOW_VALUES": "Afficher les valeurs saisies",
47+
"SHOW_VALUES": "Afficher les valeurs en clair ?",
4848
"POPOVER_SHARE": {
4949
"TITLE": "Partager",
5050
"SHARE_ON_TWITTER": "Partager sur Twitter",
@@ -281,7 +281,9 @@
281281
"CRYPTO_UNKNOWN_ERROR": "Votre navigateur ne semble pas compatible avec les fonctionnalités de cryptographie.",
282282
"FIELD_REQUIRED": "Champ obligatoire.",
283283
"FIELD_TOO_SHORT": "Valeur trop courte.",
284+
"FIELD_TOO_SHORT_WITH_LENGTH": "Valeur trop courte ({{minLength}} caractères min)",
284285
"FIELD_TOO_LONG": "Valeur trop longue",
286+
"FIELD_TOO_LONG_WITH_LENGTH": "Valeur trop longue ({{maxLength}} caractères max)",
285287
"FIELD_ACCENT": "Caractères accentués et virgules non autorisés",
286288
"PASSWORD_NOT_CONFIRMED": "Ne correspond pas au mot de passe.",
287289
"SALT_NOT_CONFIRMED": "Ne correspond pas à la phrase de protection.",

www/js/services/utils-services.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,7 @@ angular.module('cesium.utils.services', ['ngResource'])
1919
},
2020
regex = {
2121
IMAGE_SRC: exact("data:([A-Za-z//]+);base64,(.+)")
22-
},
23-
eventMatchers = {
24-
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
25-
'MouseEvents': /^(?:click|dblclick|mouse(?:down|up|over|move|out))$/
26-
},
27-
eventDefaultOptions = {
28-
pointerX: 0,
29-
pointerY: 0,
30-
button: 0,
31-
ctrlKey: false,
32-
altKey: false,
33-
shiftKey: false,
34-
metaKey: false,
35-
bubbles: true,
36-
cancelable: true
37-
}
22+
}
3823
;
3924

4025
function alertError(err, subtitle) {

www/js/services/wot-services.js

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -501,38 +501,57 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic
501501
if (!res.memberships || !res.memberships.length) {
502502
return null;
503503
}
504-
var idtiesByBlock = {}; // TODO: workaround for Duniter#667 - https://github.com/duniter/duniter/issues/667
505-
var idties = res.memberships.reduce(function(res, ms){
506-
if (ms.membership === 'IN') {
504+
var idtiesByBlock = {};
505+
var idtiesByPubkey = {};
506+
var idties = [];
507+
_.forEach(res.memberships, function(ms){
508+
if (ms.membership == 'IN') {
507509
var idty = {
508510
uid: ms.uid,
509511
pubkey: ms.pubkey,
510512
block: ms.blockNumber,
511513
blockHash: ms.blockHash
512514
};
513-
if (!idtiesByBlock[ms.blockNumber]) {
514-
idtiesByBlock[ms.blockNumber] = [idty];
515+
var otherIdtySamePubkey = idtiesByPubkey[ms.pubkey];
516+
if (otherIdtySamePubkey && idty.block > otherIdtySamePubkey.block) {
517+
return; // skip
518+
}
519+
idtiesByPubkey[idty.pubkey] = idty;
520+
if (!idtiesByBlock[idty.block]) {
521+
idtiesByBlock[idty.block] = [idty];
515522
}
516523
else {
517-
idtiesByBlock[ms.blockNumber].push(idty);
524+
idtiesByBlock[idty.block].push(idty);
525+
}
526+
527+
// Remove previous idty from maps
528+
if (otherIdtySamePubkey) {
529+
idtiesByBlock[otherIdtySamePubkey.block] = idtiesByBlock[otherIdtySamePubkey.block].reduce(function(res, aidty){
530+
if (aidty.pubkey == otherIdtySamePubkey.pubkey) return res; // if match idty to remove, to NOT add
531+
return (res||[]).concat(aidty);
532+
}, null);
533+
if (idtiesByBlock[otherIdtySamePubkey.block] === null) {
534+
delete idtiesByBlock[otherIdtySamePubkey.block];
535+
}
536+
return;
537+
}
538+
else {
539+
idties.push(idty);
518540
}
519-
return res.concat(idty);
520541
}
521-
return res;
522-
}, []);
523-
idties = _sortAndLimitIdentities(idties, size);
542+
});
543+
idties = _sortAndLimitIdentities(idtiesByPubkey, size);
524544

525545
return BMA.blockchain.blocks(_.keys(idtiesByBlock))
526546
.then(function(blocks) {
527547

528548
_.forEach(blocks, function(block){
529549
_.forEach(idtiesByBlock[block.number], function(idty) {
530550
idty.sigDate = block.medianTime;
531-
idty.valid = (idty.blockHash === block.hash);
532-
//if (!idty.valid) {
551+
if (idty.blockHash !== block.hash) {
533552
idty.errors = ['INVALID_MS_BLOCK_HASH'];
534553
console.debug("Invalid membership for uid={0}: block hash not match a real block (block cancelled)".format(idty.uid));
535-
//}
554+
}
536555
});
537556
});
538557
return $q(function(resolve, reject) {

www/templates/join/modal_join.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,7 @@ <h4 class="gray" translate>ACCOUNT.NEW.WALLET_ACCOUNT_HELP</h4>
125125
ng-show="saltForm.$submitted && saltForm.username.$error"
126126
ng-messages="saltForm.username.$error">
127127
<div class="form-error" ng-message="minlength">
128-
<span translate="ERROR.FIELD_TOO_SHORT"></span>
129-
</div>
130-
<div class="form-error" ng-message="maxlength">
131-
<span translate="ERROR.FIELD_TOO_LONG"></span>
128+
<span translate="ERROR.FIELD_TOO_SHORT_WITH_LENGTH" translate-values="{minLength: 8}"></span>
132129
</div>
133130
<div class="form-error" ng-message="required">
134131
<span translate="ERROR.FIELD_REQUIRED"></span>
@@ -225,7 +222,7 @@ <h4 class="gray" translate>ACCOUNT.NEW.WALLET_ACCOUNT_HELP</h4>
225222
ng-show="passwordForm.$submitted && passwordForm.password.$error"
226223
ng-messages="passwordForm.password.$error">
227224
<div class="form-error" ng-message="minlength">
228-
<span translate="ERROR.FIELD_TOO_SHORT"></span>
225+
<span translate="ERROR.FIELD_TOO_SHORT_WITH_LENGTH" translate-values="{minLength: 8}"></span>
229226
</div>
230227
<div class="form-error" ng-message="maxlength">
231228
<span translate="ERROR.FIELD_TOO_LONG"></span>
@@ -322,10 +319,10 @@ <h4 class="gray" translate>ACCOUNT.NEW.WALLET_ACCOUNT_HELP</h4>
322319
ng-show="pseudoForm.$submitted && pseudoForm.pseudo.$error"
323320
ng-messages="pseudoForm.pseudo.$error">
324321
<div class="form-error" ng-message="minlength">
325-
<span translate="ERROR.FIELD_TOO_SHORT"></span>
322+
<span translate="ERROR.FIELD_TOO_SHORT_WITH_LENGTH" translate-values="{minLength: 3}"></span>
326323
</div>
327324
<div class="form-error" ng-message="maxlength">
328-
<span translate="ERROR.FIELD_TOO_LONG"></span>
325+
<span translate="ERROR.FIELD_TOO_LONG_WITH_LENGTH" translate-values="{maxLength: 100}"></span>
329326
</div>
330327
<div class="form-error" ng-message="required">
331328
<span translate="ERROR.FIELD_REQUIRED"></span>

0 commit comments

Comments
 (0)