Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
refactor store by id error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jjeffryes committed Jan 16, 2020
1 parent a0a6afe commit 321585d
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 82 deletions.
8 changes: 4 additions & 4 deletions js/languages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,9 @@
"selectedModsTitle": "لا يمكن تحميل المشرفين الحاليين لديك.",
"availableModsTitle": "لا يمكن تحميل المشرفين المتاحون",
"modIsBlank": "يجب عليك إضافة معرف أو مقبض المشرف",
"notGUID": "%{guid} ليس معرف نظير صالح",
"ownGUID": "%{guid} هو معرف النظير الخاص بك. لا يمكنك الإشراف على طلباتك الخاصة.",
"dupeGUID": "%{guid} هو واحد من المشرفين الحاليين لديك."
"notPeerID": "%{guid} ليس معرف نظير صالح",
"ownPeerID": "%{guid} هو معرف النظير الخاص بك. لا يمكنك الإشراف على طلباتك الخاصة.",
"dupePeerID": "%{guid} هو واحد من المشرفين الحاليين لديك."
}
},
"blockedTab": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "الزولو",
"zu-ZA": "الزولو (جنوب إفريقيا)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/cs_CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (Jižní Afrika)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (South Africa)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (Süd Afrika)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/en_AU.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (South Africa)"
}
}
}
6 changes: 3 additions & 3 deletions js/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions js/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulú",
"zu-ZA": "Zulú (Suráfrica)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (South Africa)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/fr_CA.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (South Africa)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (Sudafrica)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (Sør-Afrika)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/nl_NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zoeloe",
"zu-ZA": "Zoeloe (Zuid Afrika)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (South Africa)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Zulu",
"zu-ZA": "Zulu (África do Sul)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Зулу",
"zu-ZA": "Зулу (Южная Африка)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,9 @@
"selectedModsTitle": "Не вдалося завантажити перелік Ваших поточних модераторів .",
"availableModsTitle": "Не вдалося завантажити доступних модераторів ",
"modIsBlank": "Ви повинні додати ідентифікатор модератора або @нікнейм",
"notGUID": "%{guid} не є дійсним ідентифікатором ID користувача",
"ownGUID": "%{guid} це ваш ідентифікатор ID. Ви не можете редагувати власні замовлення.",
"dupeGUID": "%{guid} це один з ваших поточних модераторів."
"notPeerID": "%{guid} не є дійсним ідентифікатором ID користувача",
"ownPeerID": "%{guid} це ваш ідентифікатор ID. Ви не можете редагувати власні замовлення.",
"dupePeerID": "%{guid} це один з ваших поточних модераторів."
}
},
"blockedTab": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "Зулу",
"zu-ZA": "Зулу (Південна Африка)"
}
}
}
8 changes: 4 additions & 4 deletions js/languages/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -5740,4 +5740,4 @@
"zu": "祖鲁",
"zu-ZA": "祖鲁(祖鲁语)"
}
}
}
26 changes: 11 additions & 15 deletions js/views/modals/Settings/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 321585d

Please sign in to comment.