diff --git a/js/languages/ar.json b/js/languages/ar.json index 28be152cb..6c9a87447 100644 --- a/js/languages/ar.json +++ b/js/languages/ar.json @@ -749,9 +749,9 @@ "selectedModsTitle": "لا يمكن تحميل المشرفين الحاليين لديك.", "availableModsTitle": "لا يمكن تحميل المشرفين المتاحون", "modIsBlank": "يجب عليك إضافة معرف أو مقبض المشرف", - "notGUID": "%{guid} ليس معرف نظير صالح", - "ownGUID": "%{guid} هو معرف النظير الخاص بك. لا يمكنك الإشراف على طلباتك الخاصة.", - "dupeGUID": "%{guid} هو واحد من المشرفين الحاليين لديك." + "notPeerID": "%{guid} ليس معرف نظير صالح", + "ownPeerID": "%{guid} هو معرف النظير الخاص بك. لا يمكنك الإشراف على طلباتك الخاصة.", + "dupePeerID": "%{guid} هو واحد من المشرفين الحاليين لديك." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "الزولو", "zu-ZA": "الزولو (جنوب إفريقيا)" } -} \ No newline at end of file +} diff --git a/js/languages/cs_CZ.json b/js/languages/cs_CZ.json index 11f432a30..f64dc2c49 100644 --- a/js/languages/cs_CZ.json +++ b/js/languages/cs_CZ.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Tvoje aktuální moderátory nelze načíst.", "availableModsTitle": "Dostupné moderátory nelze načíst", "modIsBlank": "Musíš přidat ID moderátora nebo handl", - "notGUID": "%{guid} není platné peer ID", - "ownGUID": "%{guid} je tvoje peer ID. Nemůžeš moderovat své vlastní objednávky.", - "dupeGUID": "%{guid} je jedním z tvých současných moderátorů." + "notPeerID": "%{guid} není platné peer ID", + "ownPeerID": "%{guid} je tvoje peer ID. Nemůžeš moderovat své vlastní objednávky.", + "dupePeerID": "%{guid} je jedním z tvých současných moderátorů." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (Jižní Afrika)" } -} \ No newline at end of file +} diff --git a/js/languages/da.json b/js/languages/da.json index 4ce7d7776..d71ac0bc9 100644 --- a/js/languages/da.json +++ b/js/languages/da.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Your Current Moderators Could Not Be Loaded.", "availableModsTitle": "Available Moderators Could Not Be Loaded", "modIsBlank": "You must add a moderator ID or handle", - "notGUID": "%{guid} is not a valid peer ID", - "ownGUID": "%{guid} is your peer ID. You cannot moderate your own orders.", - "dupeGUID": "%{guid} is one of your current moderators." + "notPeerID": "%{peerID} is not a valid peer ID", + "ownPeerID": "%{peerID} is your peer ID. You cannot moderate your own orders.", + "dupePeerID": "%{peerID} is one of your current moderators." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (South Africa)" } -} \ No newline at end of file +} diff --git a/js/languages/de_DE.json b/js/languages/de_DE.json index 8336694c2..d1b3c6199 100644 --- a/js/languages/de_DE.json +++ b/js/languages/de_DE.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Your Current Moderators Could Not Be Loaded.", "availableModsTitle": "Verfügbare Moderatoren konnten nicht geladen werden", "modIsBlank": "Sie müssen eine Moderator-ID oder -Benutzernamen angeben", - "notGUID": "%{guid} is not a valid peer ID", - "ownGUID": "%{guid} is your peer ID. You cannot moderate your own orders.", - "dupeGUID": "%{guid} is one of your current moderators." + "notPeerID": "%{peerID} is not a valid peer ID", + "ownPeerID": "%{peerID} is your peer ID. You cannot moderate your own orders.", + "dupePeerID": "%{peerID} is one of your current moderators." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (Süd Afrika)" } -} \ No newline at end of file +} diff --git a/js/languages/en_AU.json b/js/languages/en_AU.json index 88d1cdc6c..4b1395959 100644 --- a/js/languages/en_AU.json +++ b/js/languages/en_AU.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Your Current Moderators Could Not Be Loaded.", "availableModsTitle": "Available Moderators Could Not Be Loaded", "modIsBlank": "You must add a moderator ID or handle", - "notGUID": "%{guid} is not a valid peer ID", - "ownGUID": "%{guid} is your peer ID. You cannot moderate your own orders.", - "dupeGUID": "%{guid} is one of your current moderators." + "notPeerID": "%{peerID} is not a valid peer ID", + "ownPeerID": "%{peerID} is your peer ID. You cannot moderate your own orders.", + "dupePeerID": "%{peerID} is one of your current moderators." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (South Africa)" } -} \ No newline at end of file +} diff --git a/js/languages/en_US.json b/js/languages/en_US.json index 333cf69e9..b18392524 100644 --- a/js/languages/en_US.json +++ b/js/languages/en_US.json @@ -405,7 +405,7 @@ "PERCENTAGE": "%{percentage}%*", "FIXED_PLUS_PERCENTAGE": "%{amount} (+%{percentage}%)*", "failed": "The information for this moderator failed to load.", - "invalid": "This user is not currently a moderator.", + "invalid": "This user is not currently a valid moderator.", "noCoinSupport": "This moderator does not accept any of the coins your wallet supports.", "noPreferredSupport": "This moderator does not accept any of your preferred coins. They can only moderate transactions in the following currencies: %{coins}.", "languages": "%{lang}, and %{smart_count} other language. |||| %{lang}, and %{smart_count} other languages." @@ -752,9 +752,9 @@ "selectedModsTitle": "Your Current Moderators Could Not Be Loaded.", "availableModsTitle": "Available Moderators Could Not Be Loaded", "modIsBlank": "You must add a moderator ID or handle", - "notGUID": "%{guid} is not a valid peer ID", - "ownGUID": "%{guid} is your peer ID. You cannot moderate your own orders.", - "dupeGUID": "%{guid} is one of your current moderators." + "notPeerID": "%{peerID} is not a valid peer ID", + "ownPeerID": "%{peerID} is your peer ID. You cannot moderate your own orders.", + "dupePeerID": "%{peerID} is one of your current moderators." } }, "blockedTab": { @@ -1528,20 +1528,20 @@ "moderatorsLoaded": "%{total} moderator loaded |||| %{total} moderators loaded.", "noModsMsg": { "noModerators": { - "title": "No Valid Moderators Are Available.", - "body": "None of the loaded moderators are valid. This order will be a direct payment." + "title": "No valid moderators have been loaded.", + "body": "This order will be a direct payment." }, "noVerifiedModerators": { - "title": "No Verified Moderators Available", + "title": "No verified moderators have been loaded.", "body": "Try viewing unverified moderators." }, "noMatchingModerators": { - "title": "No moderators that accept %{coin} are available.", + "title": "No moderators that accept %{coin} have been loaded.", "body": "Moderators are available on one or more of the other currencies accepted by this listing." }, "noMatchingVerifiedModerators": { "title": "No verified moderators that accept %{coin} have been loaded.", - "body": "Try viewing unverified moderators." + "body": "Try viewing unverified moderators or using another currency." } }, "showUnverified": "Show Unverified Moderators", @@ -2073,7 +2073,8 @@ "descriptionLength": "Descriptions must be no more than 300 characters", "noTerms": "Please provide your terms of service.", "termsLength": "Terms of service must be no more than 10,000 characters", - "noLanguages": "Please list at least one language you can communicate in." + "noLanguages": "Please list at least one language you can communicate in.", + "invalidData": "The value for %{field} is invalid or missing." }, "feeModelErrors": { "noFeeType": "Please set a valid fee type", @@ -2125,7 +2126,7 @@ "mustHaveQuantity": "The quantity must be 1 or more", "quantityMustBeInteger": "The quantity must be a valid non-decimal number.", "quantityMustBeNumeric": "The quantity must be a valid number. If including a decimal, a period should be used as the seperator, for example \"0.00\".", - "cryptoQuantityMustBeNumeric": "The amount must be a valid number. If including a decimal, a period should be used as the seperator, for example \"0.00\".", + "cryptoQuantityMustBeNumeric": "The amount must be a valid number. If including a decimal, a period should be used as the seperator, for example \"0.00\".", "cryptoQuantityMustBePositive": "The amount must be greater than zero.", "fractionTooLow": "%{cur} does not support more than %{coinDiv} decimal places. Please round up the amount so no more than %{coinDiv} decimal places are represented.", "missingShippingOption": "Please choose a valid shipping option.", @@ -5765,4 +5766,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (South Africa)" } -} \ No newline at end of file +} diff --git a/js/languages/es.json b/js/languages/es.json index 3bf2994fb..83d7c04da 100644 --- a/js/languages/es.json +++ b/js/languages/es.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Tus Moderadores Actuales No Se Cargaron", "availableModsTitle": "Los Moderadores Disponibles No Se Cargaron", "modIsBlank": "Debe añadir un ID de moderador o manija (@)", - "notGUID": "%{guid} no es un ID de par válido", - "ownGUID": "%{guid} es tu ID de par. No puedes moderar tus propios pedidos.", - "dupeGUID": "%{guid} es uno de tus moderadores actuales." + "notPeerID": "%{guid} no es un ID de par válido", + "ownPeerID": "%{guid} es tu ID de par. No puedes moderar tus propios pedidos.", + "dupePeerID": "%{guid} es uno de tus moderadores actuales." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulú", "zu-ZA": "Zulú (Suráfrica)" } -} \ No newline at end of file +} diff --git a/js/languages/fr.json b/js/languages/fr.json index 729f995c2..a14f4e1e8 100644 --- a/js/languages/fr.json +++ b/js/languages/fr.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Vos modérateurs actuels n'ont pas pu être chargés.", "availableModsTitle": "Les modérateurs disponibles n'ont pas pu être chargés", "modIsBlank": "Vous devez ajouter un ID de modérateur ou un handle", - "notGUID": "%{guid} n'est pas un peer ID valide", - "ownGUID": "%{guid} est votre peer ID. Vous ne pouvez pas modérer vos propres commandes.", - "dupeGUID": "%{guid} est l'un de vos modérateurs actuels." + "notPeerID": "%{guid} n'est pas un peer ID valide", + "ownPeerID": "%{guid} est votre peer ID. Vous ne pouvez pas modérer vos propres commandes.", + "dupePeerID": "%{guid} est l'un de vos modérateurs actuels." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (South Africa)" } -} \ No newline at end of file +} diff --git a/js/languages/fr_CA.json b/js/languages/fr_CA.json index 5bcbbdd9b..329790a5c 100644 --- a/js/languages/fr_CA.json +++ b/js/languages/fr_CA.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Your Current Moderators Could Not Be Loaded.", "availableModsTitle": "Available Moderators Could Not Be Loaded", "modIsBlank": "Vous devez ajouter un ID de modérateur ou un handle", - "notGUID": "%{guid} is not a valid peer ID", - "ownGUID": "%{guid} is your peer ID. You cannot moderate your own orders.", - "dupeGUID": "%{guid} is one of your current moderators." + "notPeerID": "%{peerID} is not a valid peer ID", + "ownPeerID": "%{peerID} is your peer ID. You cannot moderate your own orders.", + "dupePeerID": "%{peerID} is one of your current moderators." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (South Africa)" } -} \ No newline at end of file +} diff --git a/js/languages/it_IT.json b/js/languages/it_IT.json index 0225ac630..2d47c6497 100644 --- a/js/languages/it_IT.json +++ b/js/languages/it_IT.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Your Current Moderators Could Not Be Loaded.", "availableModsTitle": "Available Moderators Could Not Be Loaded", "modIsBlank": "Devi aggiungere l'iD o handle di un moderatore", - "notGUID": "%{guid} is not a valid peer ID", - "ownGUID": "%{guid} is your peer ID. You cannot moderate your own orders.", - "dupeGUID": "%{guid} is one of your current moderators." + "notPeerID": "%{peerID} is not a valid peer ID", + "ownPeerID": "%{peerID} is your peer ID. You cannot moderate your own orders.", + "dupePeerID": "%{peerID} is one of your current moderators." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (Sudafrica)" } -} \ No newline at end of file +} diff --git a/js/languages/nb.json b/js/languages/nb.json index 4e129bccd..9bfca0c7c 100644 --- a/js/languages/nb.json +++ b/js/languages/nb.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Dine Nåværende Moderatorer Kunne Ikke Lastes.", "availableModsTitle": "Tilgjengelige Moderatorer Kunne Ikke Lastes", "modIsBlank": "Du må legge til en moderator ID eller kallenavn", - "notGUID": "%{guid} er ikke en gyldig node ID", - "ownGUID": "%{guid} er din node ID. Du kan ikke moderere dine egne bestillinger.", - "dupeGUID": "%{guid} er en av dine nåværende moderatorer." + "notPeerID": "%{guid} er ikke en gyldig node ID", + "ownPeerID": "%{guid} er din node ID. Du kan ikke moderere dine egne bestillinger.", + "dupePeerID": "%{guid} er en av dine nåværende moderatorer." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (Sør-Afrika)" } -} \ No newline at end of file +} diff --git a/js/languages/nl_NL.json b/js/languages/nl_NL.json index 903ca244c..82a4907ec 100644 --- a/js/languages/nl_NL.json +++ b/js/languages/nl_NL.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Uw huidige moderators konden niet geladen worden.", "availableModsTitle": "Beschikbare moderators konden niet geladen worden.", "modIsBlank": "Je moet een ID of Handle van de moderator toevoegen.", - "notGUID": "%{guid} is niet een valide peer ID", - "ownGUID": "%{guid} is uw peer ID. U kunt niet uw eigen orders modereren.", - "dupeGUID": "%{guid} is een van uw huidige moderators." + "notPeerID": "%{peerID} is niet een valide peer ID", + "ownPeerID": "%{peerID} is uw peer ID. U kunt niet uw eigen orders modereren.", + "dupePeerID": "%{peerID} is een van uw huidige moderators." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zoeloe", "zu-ZA": "Zoeloe (Zuid Afrika)" } -} \ No newline at end of file +} diff --git a/js/languages/pl.json b/js/languages/pl.json index 441d14644..0c91cc6ed 100644 --- a/js/languages/pl.json +++ b/js/languages/pl.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Your Current Moderators Could Not Be Loaded.", "availableModsTitle": "Available Moderators Could Not Be Loaded", "modIsBlank": "You must add a moderator ID or handle", - "notGUID": "%{guid} is not a valid peer ID", - "ownGUID": "%{guid} is your peer ID. You cannot moderate your own orders.", - "dupeGUID": "%{guid} is one of your current moderators." + "notPeerID": "%{peerID} is not a valid peer ID", + "ownPeerID": "%{peerID} is your peer ID. You cannot moderate your own orders.", + "dupePeerID": "%{peerID} is one of your current moderators." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (South Africa)" } -} \ No newline at end of file +} diff --git a/js/languages/pt_BR.json b/js/languages/pt_BR.json index 2c3ec4738..47dc4777f 100644 --- a/js/languages/pt_BR.json +++ b/js/languages/pt_BR.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Seus Moderadores Atuais Não Puderam Ser Carregados.", "availableModsTitle": "Os Moderadores Disponíveis Não Puderam Ser Carregados", "modIsBlank": "Insira um @apelido ou ID de um moderador", - "notGUID": "%{guid} não é um ID de usuário válido", - "ownGUID": "%{guid} é o seu ID de usuário. Você não pode moderar os seus próprios pedidos.", - "dupeGUID": "%{guid} é um de seus moderadores atuais." + "notPeerID": "%{guid} não é um ID de usuário válido", + "ownPeerID": "%{guid} é o seu ID de usuário. Você não pode moderar os seus próprios pedidos.", + "dupePeerID": "%{guid} é um de seus moderadores atuais." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Zulu", "zu-ZA": "Zulu (África do Sul)" } -} \ No newline at end of file +} diff --git a/js/languages/ru.json b/js/languages/ru.json index c5b1c750c..8caeab97c 100644 --- a/js/languages/ru.json +++ b/js/languages/ru.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Your Current Moderators Could Not Be Loaded.", "availableModsTitle": "Available Moderators Could Not Be Loaded", "modIsBlank": "Необходимо добавить ID или дескриптор модератора.", - "notGUID": "%{guid} is not a valid peer ID", - "ownGUID": "%{guid} is your peer ID. You cannot moderate your own orders.", - "dupeGUID": "%{guid} is one of your current moderators." + "notPeerID": "%{peerID} is not a valid peer ID", + "ownPeerID": "%{peerID} is your peer ID. You cannot moderate your own orders.", + "dupePeerID": "%{peerID} is one of your current moderators." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Зулу", "zu-ZA": "Зулу (Южная Африка)" } -} \ No newline at end of file +} diff --git a/js/languages/uk.json b/js/languages/uk.json index 078ea489d..db948696f 100644 --- a/js/languages/uk.json +++ b/js/languages/uk.json @@ -749,9 +749,9 @@ "selectedModsTitle": "Не вдалося завантажити перелік Ваших поточних модераторів .", "availableModsTitle": "Не вдалося завантажити доступних модераторів ", "modIsBlank": "Ви повинні додати ідентифікатор модератора або @нікнейм", - "notGUID": "%{guid} не є дійсним ідентифікатором ID користувача", - "ownGUID": "%{guid} це ваш ідентифікатор ID. Ви не можете редагувати власні замовлення.", - "dupeGUID": "%{guid} це один з ваших поточних модераторів." + "notPeerID": "%{guid} не є дійсним ідентифікатором ID користувача", + "ownPeerID": "%{guid} це ваш ідентифікатор ID. Ви не можете редагувати власні замовлення.", + "dupePeerID": "%{guid} це один з ваших поточних модераторів." } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "Зулу", "zu-ZA": "Зулу (Південна Африка)" } -} \ No newline at end of file +} diff --git a/js/languages/zh_CN.json b/js/languages/zh_CN.json index 6073ee5aa..a478db995 100644 --- a/js/languages/zh_CN.json +++ b/js/languages/zh_CN.json @@ -749,9 +749,9 @@ "selectedModsTitle": "无法加载你当前的仲裁人。", "availableModsTitle": "无法加载可用的仲裁人", "modIsBlank": "您必须添加仲裁人ID或句柄", - "notGUID": "%{guid}不是有效的节点ID", - "ownGUID": "%{guid}是你的节点ID,你无法审查你自己的订单。", - "dupeGUID": "%{guid}是您当前的仲裁人之一。" + "notPeerID": "%{guid}不是有效的节点ID", + "ownPeerID": "%{guid}是你的节点ID,你无法审查你自己的订单。", + "dupePeerID": "%{guid}是您当前的仲裁人之一。" } }, "blockedTab": { @@ -5740,4 +5740,4 @@ "zu": "祖鲁", "zu-ZA": "祖鲁(祖鲁语)" } -} \ No newline at end of file +} diff --git a/js/templates/components/moderators/card.html b/js/templates/components/moderators/card.html index c62e6b0df..a5391d8fe 100644 --- a/js/templates/components/moderators/card.html +++ b/js/templates/components/moderators/card.html @@ -1,13 +1,16 @@ <% // Check to see if the card was created with at least minimum data, not just a peerID, which would indicate a server error. const loaded = !!ob.name; + /* Disable the card if it is invalid and the controls should be shown, and it is not selected. This allow the user to de-select invalid cards. - The view should prevent the invalid card from being selected again, disabling it is redundant but important visually. */ - const isDisabled = (!ob.valid && !ob.controlsOnInvalid ) || (!ob.valid && ob.controlsOnInvalid && ob.selectedState !== 'selected') || !loaded ? 'disabled' : ''; + * The view should prevent the invalid card from being selected again, disabling it is redundant but important visually. + */ + const isOKMod = ob.hasValidModel && ob.isMod; + const disabledClass = (!isOKMod && !ob.controlsOnInvalid ) || (!isOKMod && ob.controlsOnInvalid && ob.selectedState !== 'selected') || !loaded ? 'disabled' : ''; const style = ob.verified ? 'verified clrBrAlert2 clrBAlert2Grad' : ''; %> -
+
<% if (ob.radioStyle) { %>
@@ -29,7 +32,7 @@ <%= ob.handle ? `@${ob.handle}` : '' %>
- <% if (ob.valid) { %> + <% if (isOKMod) { %>
<%=ob.moderatorInfo.description %>
<% if (ob.modLanguages && ob.modLanguages.length) { %>
@@ -64,11 +67,20 @@ <%= ob.polyT('moderatorCard.noCoinSupport') %> <% } %>
- <% if (ob.showPreferredWarning) { %> -
<%= ob.polyT('moderatorCard.noPreferredSupport', { coins: ob.moderatorInfo.acceptedCurrencies.join(', ') }) %>
- <% } %> + <% if (ob.showPreferredWarning) { %> +
<%= ob.polyT('moderatorCard.noPreferredSupport', { coins: ob.moderatorInfo.acceptedCurrencies.join(', ') }) %>
+ <% } %> <% } else { %> <%= ob.polyT('moderatorCard.invalid') %> + <% + if (ob.modelErrors) { + const translatedErrs = []; + Object.keys(ob.modelErrors).forEach(field => { + translatedErrs.push(ob.polyT('moderatorModelErrors.invalidData', { field })); + }); + print(ob.formErrorTmpl({ errors: translatedErrs })); + } + %> <% } %>
<% } else { %> @@ -79,9 +91,9 @@ <% } %>
- <% if (ob.valid || ob.controlsOnInvalid) { %> + <% if (isOKMod || ob.controlsOnInvalid) { %>
- <% if (ob.valid) { %> + <% if (isOKMod) { %> diff --git a/js/templates/components/moderators/moderators.html b/js/templates/components/moderators/moderators.html index 5137ae87b..d226f9383 100644 --- a/js/templates/components/moderators/moderators.html +++ b/js/templates/components/moderators/moderators.html @@ -1,12 +1,5 @@
- <% // placeholder so border collapse doesn't erase the table border when there are no table cells %> - <% if (ob.placeholder) { %> -
-
-
-
- <% } %> - <% if (ob.totalIDs && !ob.totalShown) { %> + <% if (!ob.totalShown) { %>
@@ -15,10 +8,12 @@ const showOnlyCur = ob.showOnlyCur ? 'Matching' : ''; const opts = ob.showOnlyCur ? { coin: ob.showOnlyCur } : {}; const msgPath = `moderators.noModsMsg.no${showOnlyCur}${showOnlyVer}Moderators`; + const title = ob.loading ? + ob.polyT('moderators.moderatorsLoading') : ob.polyT(`${msgPath}.title`, opts); %> -

<%= ob.polyT(`${msgPath}.title`, opts) %>

<% // The section below is only relevant if the moderators are loaded in a purchasing context. %> - <% if (ob.purchase) { %> + <% if (ob.purchase && !ob.loading) { %> +

<%= title %>

<%= ob.polyT(`${msgPath}.body`) %>
<% if (showOnlyVer) { %>
<% // just a spacer %>
@@ -34,4 +29,3 @@

<%= ob.polyT(`${msgPath}.title`, opts) %>

<% } %>
- diff --git a/js/templates/components/moderators/status.html b/js/templates/components/moderators/status.html index 98a9d476a..5d8581e32 100644 --- a/js/templates/components/moderators/status.html +++ b/js/templates/components/moderators/status.html @@ -2,7 +2,7 @@ <% if (ob.showSpinner && ob.loading) { %> <%= ob.spinner({ className: 'spinnerTxt js-spinner' }) %> <% } %> - + <% if (ob.mode === 'loaded') { print(ob.polyT('moderators.moderatorsLoaded', { total: ob.total, smart_count: ob.total })); } else if (ob.mode === 'loadingXofY') { diff --git a/js/views/components/moderators/Card.js b/js/views/components/moderators/Card.js index 38db7c9fd..6799a0815 100644 --- a/js/views/components/moderators/Card.js +++ b/js/views/components/moderators/Card.js @@ -7,6 +7,7 @@ import VerifiedMod, { getModeratorOptions } from '../VerifiedMod'; import { handleLinks } from '../../../utils/dom'; import { launchModeratorDetailsModal } from '../../../utils/modalManager'; import { anySupportedByWallet } from '../../../data/walletCurrencies'; +import { getCurrencyByCode } from '../../../data/currencies'; import { getLangByCode } from '../../../data/languages'; export default class extends BaseVw { @@ -44,6 +45,10 @@ export default class extends BaseVw { const modInfo = this.model.get('moderatorInfo'); this.modCurs = modInfo && modInfo.get('acceptedCurrencies') || []; + const fee = modInfo && modInfo.get('fee'); + const fixedFee = fee && fee.get('fixedFee'); + this.fixedFeeCur = fixedFee && fixedFee.get('currencyCode'); + this.modLanguages = []; if (this.model.isModerator) { this.modLanguages = this.model.get('moderatorInfo') @@ -86,7 +91,8 @@ export default class extends BaseVw { } get hasValidCurrency() { - return anySupportedByWallet(this.modCurs); + const validFeeCur = this.fixedFeeCur && getCurrencyByCode(this.fixedFeeCur); + return validFeeCur && anySupportedByWallet(this.modCurs); } get hasPreferredCur() { @@ -125,8 +131,10 @@ export default class extends BaseVw { loadTemplate('components/moderators/card.html', (t) => { this.$el.html(t({ + hasValidModel: this.model.isValid(), + modelErrors: this.model.validationError, displayCurrency: app.settings.get('localCurrency'), - valid: this.model.isModerator, + isMod: this.model.isModerator, hasValidCurrency: this.hasValidCurrency, radioStyle: this.options.radioStyle, controlsOnInvalid: this.options.controlsOnInvalid, diff --git a/js/views/components/moderators/Moderators.js b/js/views/components/moderators/Moderators.js index 006d2232f..ab9a98025 100644 --- a/js/views/components/moderators/Moderators.js +++ b/js/views/components/moderators/Moderators.js @@ -94,9 +94,9 @@ export default class extends baseVw { super(opts); this.options = opts; - this.excludeIDs = opts.excludeIDs; + this.excludeIDs = [...opts.excludeIDs, app.profile.id]; + this.modsToFetch = [...opts.moderatorIDs]; this.unfetchedMods = []; - this.fetchingMods = []; this.fetchingVerifiedMods = []; this.modFetches = []; this.moderatorsCol = new Moderators(); @@ -139,8 +139,11 @@ export default class extends baseVw { this.getModeratorsByID(); } - removeNotFetched(ID) { - this.unfetchedMods = this.unfetchedMods.filter(peerID => peerID !== ID); + removeNotFetched(IDs) { + const IDlist = Array.isArray(IDs) ? IDs : [IDs]; + IDlist.forEach(ID => { + this.unfetchedMods = this.unfetchedMods.filter(peerID => peerID !== ID); + }); this.checkNotFetched(); } @@ -151,11 +154,11 @@ export default class extends baseVw { // If the moderator has an invalid currency, remove them from the list. // With multi-wallet, this should be a very rare occurrence. const modCurs = data.moderatorInfo && data.moderatorInfo.acceptedCurrencies || []; - const supportedCur = anySupportedByWallet(modCurs); + const hasSupportedCur = anySupportedByWallet(modCurs); + const newMod = new Moderator(data, { parse: true }); - if ((!!isAMod && supportedCur || this.options.showInvalid)) { - const newMod = new Moderator(data, { parse: true }); - if (newMod.isValid()) this.moderatorsCol.add(newMod); + if ((!!isAMod && hasSupportedCur && newMod.isValid() || this.options.showInvalid)) { + this.moderatorsCol.add(newMod); this.removeNotFetched(data.peerID); } else { // remove the invalid moderator from the notFetched list @@ -173,9 +176,6 @@ export default class extends baseVw { throw new Error('Please provide the list of moderators as an array.'); } - // don't get any that have already been added or excluded, or the user's own id. - const excluded = [app.profile.id, ...this.allIDs, ...this.excludeIDs]; - const IDs = _.without(op.moderatorIDs, excluded); const includeString = op.include ? `&include=${op.include}` : ''; let urlString = @@ -189,22 +189,24 @@ export default class extends baseVw { const url = app.getServerUrl(urlString); - this.unfetchedMods = IDs; - this.fetchingMods = IDs; - this.fetchingVerifiedMods = app.verifiedMods.matched(IDs); - - this.setState({ - loading: true, - noValidModerators: false, - noValidVerifiedModerators: !this.fetchingVerifiedMods.length, - }); + // don't get any that have already been added or excluded. + const excluded = [...this.allIDs, ...this.excludeIDs]; + this.modsToFetch = _.without(op.moderatorIDs, ...excluded); + this.unfetchedMods = [...this.modsToFetch]; + this.fetchingVerifiedMods = app.verifiedMods.matched(this.modsToFetch); // Either a list of IDs can be posted, or any available moderators can be retrieved with GET - if (IDs.length || op.method === 'GET') { + if (this.modsToFetch.length || op.method === 'GET') { + this.setState({ + loading: true, + noValidModerators: false, + noValidVerifiedModerators: !this.fetchingVerifiedMods.length, + }); + this.moderatorsStatus.setState({ hidden: false, loaded: 0, - toLoad: IDs.length, + toLoad: this.modsToFetch.length, total: this.modCount, loading: true, }); @@ -215,13 +217,14 @@ export default class extends baseVw { const eventData = event.jsonData; if (eventData.error) { // errors don't have a message id, check to see if the peerID matches - if (IDs.includes(eventData.peerId)) { - // provide the expected capitalization of peerID - eventData.peerID = eventData.peerId; - delete eventData.peerId; + if (this.modsToFetch.includes(eventData.peerId)) { this.processMod(eventData); } - } else if (eventData.id === asyncID && !excluded.includes(eventData.peerId)) { + } else if ( + eventData.id === asyncID && + !excluded.includes(eventData.peerId) && + eventData.profile + ) { this.processMod(eventData.profile); } }); @@ -232,7 +235,7 @@ export default class extends baseVw { const fetch = $.ajax({ url, - data: JSON.stringify(IDs), + data: JSON.stringify(this.modsToFetch), method: op.method, }) .done((data) => { @@ -240,9 +243,10 @@ export default class extends baseVw { data.forEach(mod => { if (!excluded.includes(mod.peerId)) this.processMod(mod.profile); }); - this.unfetchedMods = []; - this.checkNotFetched(); - if (!data.length) this.trigger('noModsFound', { guids: IDs }); + if (!data.length) { + this.trigger('noModsFound', { guids: this.modsToFetch }); + this.removeNotFetched(this.modsToFetch); + } } }) .fail((xhr) => { @@ -269,7 +273,7 @@ export default class extends baseVw { } checkNotFetched() { - if (this.unfetchedMods.length === 0 && this.fetchingMods.length) { + if (this.unfetchedMods.length === 0) { // All ids have been fetched and ids existed to fetch. this.moderatorsStatus.setState({ loading: false, @@ -282,7 +286,7 @@ export default class extends baseVw { // Either ids are still fetching, or this is an open fetch with no set ids. this.moderatorsStatus.setState({ loaded: this.moderatorsCol.length, // not shown if open fetch - toLoad: this.fetchingMods.length, // not shown if open fetch + toLoad: this.modsToFetch.length, // not shown if open fetch total: this.modCount, }); // re-render to show the unverified moderators button if needed. @@ -413,19 +417,16 @@ export default class extends baseVw { render() { const state = this.getState(); const showMods = this.modCards.filter(mod => this.modShouldRender(mod.model)); - const unVerCount = this.modCards.filter(mod => - mod.model.hasModCurrency(state.showOnlyCur) && !mod.model.isVerified).length; - const totalIDs = this.allIDs.length; + const unVerCount = this.modCards.filter(mod => (!state.showOnlyCur || + mod.model.hasModCurrency(state.showOnlyCur)) && !mod.model.isVerified).length; clearTimeout(this.renderTimer); this.renderTimer = null; loadTemplate('components/moderators/moderators.html', t => { this.$el.html(t({ wrapperClasses: this.options.wrapperClasses, - placeholder: !showMods.length && (this.unfetchedMods.length || !totalIDs), purchase: this.options.purchase, totalShown: showMods.length, - totalIDs, unVerCount, ...state, })); diff --git a/js/views/components/moderators/Status.js b/js/views/components/moderators/Status.js index 32f577e8c..109556768 100644 --- a/js/views/components/moderators/Status.js +++ b/js/views/components/moderators/Status.js @@ -38,7 +38,7 @@ export default class extends BaseVw { let mode = this.getState().mode; if (mode === 'loadingXofY') mode = 'loadingXofYTimedOut'; this.setState({ showSpinner: false, mode }); - }, 10000); + }, 60000); } super.setState(state, options); } diff --git a/js/views/modals/Settings/Store.js b/js/views/modals/Settings/Store.js index d4c807ec4..0d6474509 100644 --- a/js/views/modals/Settings/Store.js +++ b/js/views/modals/Settings/Store.js @@ -196,22 +196,18 @@ export default class extends baseVw { modID = modID.split('/')[0]; modID = modID.trim(); - if (isMultihash(modID)) { - if (!this.currentMods.includes(modID)) { - if (modID !== app.profile.id) { - this.modsByID.getModeratorsByID({ moderatorIDs: [modID] }); - this.getCachedEl('.js-modListByID').removeClass('hide'); - } else { - const ownGUID = app.polyglot.t('settings.storeTab.errors.ownGUID', { guid: modID }); - this.showModByIDError(ownGUID); - } - } else { - const dupeGUID = app.polyglot.t('settings.storeTab.errors.dupeGUID', { guid: modID }); - this.showModByIDError(dupeGUID); - } + if (!isMultihash(modID)) { + const notPeerID = app.polyglot.t('settings.storeTab.errors.notPeerID', { peerID: modID }); + this.showModByIDError(notPeerID); + } else if (this.currentMods.includes(modID)) { + const dupe = app.polyglot.t('settings.storeTab.errors.dupePeerID', { peerID: modID }); + this.showModByIDError(dupe); + } else if (modID === app.profile.id) { + const ownPeerID = app.polyglot.t('settings.storeTab.errors.ownPeerID', { peerID: modID }); + this.showModByIDError(ownPeerID); } else { - const notGUID = app.polyglot.t('settings.storeTab.errors.notGUID', { guid: modID }); - this.showModByIDError(notGUID); + this.modsByID.getModeratorsByID({ moderatorIDs: [modID] }); + this.getCachedEl('.js-modListByID').removeClass('hide'); } } else { const blankError = app.polyglot.t('settings.storeTab.errors.modIsBlank'); @@ -286,22 +282,11 @@ export default class extends baseVw { const remAvail = this.modsAvailable.removeModeratorsByID(this.modsAvailable.selectedIDs); this.modsByID.excludeIDs = this.currentMods; - this.modsByID.moderatorsStatus.setState({ - hidden: true, - }); this.modsSelected.moderatorsCol.add([...remByID, ...remAvail]); - this.modsSelected.moderatorsStatus.setState({ - hidden: true, - }); this.modsAvailable.excludeIDs = this.currentMods; this.modsAvailable.moderatorsCol.add(remSel); - this.modsAvailable.moderatorsStatus.setState({ - hidden: false, - total: this.modsAvailable.modCount, - showSpinner: false, - }); // If any of the mods moved to the available collect are unverified, show them if (app.verifiedMods.matched(unSel).length !== unSel.length) { diff --git a/js/views/modals/purchase/Purchase.js b/js/views/modals/purchase/Purchase.js index dc68dee4b..d6c8df063 100644 --- a/js/views/modals/purchase/Purchase.js +++ b/js/views/modals/purchase/Purchase.js @@ -185,7 +185,7 @@ export default class extends BaseModal { singleSelect: true, radioStyle: true, initialState: { - showOnlyCur: currencies[0], + showOnlyCur: '', showVerifiedOnly: true, }, });