From 321585d038de17e667c9e128d7a08c161486a992 Mon Sep 17 00:00:00 2001 From: jjeffryes Date: Thu, 16 Jan 2020 12:42:36 -0500 Subject: [PATCH] refactor store by id error handling --- js/languages/ar.json | 8 ++++---- js/languages/cs_CZ.json | 8 ++++---- js/languages/da.json | 8 ++++---- js/languages/de_DE.json | 8 ++++---- js/languages/en_AU.json | 8 ++++---- js/languages/en_US.json | 6 +++--- js/languages/es.json | 8 ++++---- js/languages/fr.json | 8 ++++---- js/languages/fr_CA.json | 8 ++++---- js/languages/it_IT.json | 8 ++++---- js/languages/nb.json | 8 ++++---- js/languages/nl_NL.json | 8 ++++---- js/languages/pl.json | 8 ++++---- js/languages/pt_BR.json | 8 ++++---- js/languages/ru.json | 8 ++++---- js/languages/uk.json | 8 ++++---- js/languages/zh_CN.json | 8 ++++---- js/views/modals/Settings/Store.js | 26 +++++++++++--------------- 18 files changed, 78 insertions(+), 82 deletions(-) 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 b799d398b..32fd66748 100644 --- a/js/languages/en_US.json +++ b/js/languages/en_US.json @@ -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": { 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/views/modals/Settings/Store.js b/js/views/modals/Settings/Store.js index 24985c5ab..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');