From ce643182194329c3230b9854f56baadc2c11186d Mon Sep 17 00:00:00 2001 From: jjeffryes Date: Thu, 9 Jan 2020 17:57:51 -0500 Subject: [PATCH 1/3] Handle Mod With Missing Fixed Fee Currency --- js/views/components/moderators/Card.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/views/components/moderators/Card.js b/js/views/components/moderators/Card.js index 38db7c9fd..18b43a918 100644 --- a/js/views/components/moderators/Card.js +++ b/js/views/components/moderators/Card.js @@ -44,6 +44,9 @@ export default class extends BaseVw { const modInfo = this.model.get('moderatorInfo'); this.modCurs = modInfo && modInfo.get('acceptedCurrencies') || []; + const fixedFee = modInfo && modInfo.get('fee').get('fixedFee'); + this.feeCur = fixedFee && fixedFee.get('currencyCode'); + this.modLanguages = []; if (this.model.isModerator) { this.modLanguages = this.model.get('moderatorInfo') @@ -86,7 +89,7 @@ export default class extends BaseVw { } get hasValidCurrency() { - return anySupportedByWallet(this.modCurs); + return this.feeCur && anySupportedByWallet([...this.modCurs, this.feeCur]); } get hasPreferredCur() { From deebd4d6523d59291e82a070abe9b93ec27f6b56 Mon Sep 17 00:00:00 2001 From: jjeffryes Date: Fri, 10 Jan 2020 09:02:09 -0500 Subject: [PATCH 2/3] just validate when the model is added --- js/views/components/moderators/Card.js | 5 +---- js/views/components/moderators/Moderators.js | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/js/views/components/moderators/Card.js b/js/views/components/moderators/Card.js index 18b43a918..38db7c9fd 100644 --- a/js/views/components/moderators/Card.js +++ b/js/views/components/moderators/Card.js @@ -44,9 +44,6 @@ export default class extends BaseVw { const modInfo = this.model.get('moderatorInfo'); this.modCurs = modInfo && modInfo.get('acceptedCurrencies') || []; - const fixedFee = modInfo && modInfo.get('fee').get('fixedFee'); - this.feeCur = fixedFee && fixedFee.get('currencyCode'); - this.modLanguages = []; if (this.model.isModerator) { this.modLanguages = this.model.get('moderatorInfo') @@ -89,7 +86,7 @@ export default class extends BaseVw { } get hasValidCurrency() { - return this.feeCur && anySupportedByWallet([...this.modCurs, this.feeCur]); + return anySupportedByWallet(this.modCurs); } get hasPreferredCur() { diff --git a/js/views/components/moderators/Moderators.js b/js/views/components/moderators/Moderators.js index abee9a9e0..a8ece1d6a 100644 --- a/js/views/components/moderators/Moderators.js +++ b/js/views/components/moderators/Moderators.js @@ -153,7 +153,7 @@ export default class extends baseVw { const validCur = anySupportedByWallet(modCurs); if ((!!validMod && validCur || this.options.showInvalid)) { - this.moderatorsCol.add(new Moderator(data, { parse: true })); + this.moderatorsCol.add(new Moderator(data, { parse: true, validate: true })); this.removeNotFetched(data.peerID); } else { // remove the invalid moderator from the notFetched list From 1f9cd7a54cd749425652b30ceacb98be5fb8cdf9 Mon Sep 17 00:00:00 2001 From: jjeffryes Date: Fri, 10 Jan 2020 09:52:22 -0500 Subject: [PATCH 3/3] create then add if valid --- js/views/components/moderators/Moderators.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/views/components/moderators/Moderators.js b/js/views/components/moderators/Moderators.js index a8ece1d6a..5ab732937 100644 --- a/js/views/components/moderators/Moderators.js +++ b/js/views/components/moderators/Moderators.js @@ -153,7 +153,8 @@ export default class extends baseVw { const validCur = anySupportedByWallet(modCurs); if ((!!validMod && validCur || this.options.showInvalid)) { - this.moderatorsCol.add(new Moderator(data, { parse: true, validate: true })); + const newMod = new Moderator(data, { parse: true }); + if (newMod.isValid()) this.moderatorsCol.add(newMod); this.removeNotFetched(data.peerID); } else { // remove the invalid moderator from the notFetched list