Test langs (#7062)

* fix languages

* bump

* bump
This commit is contained in:
jessopb 2021-09-11 13:32:25 -04:00 committed by GitHub
parent be725639d3
commit 579230d135
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 4 deletions

View file

@ -155,7 +155,7 @@
"imagesloaded": "^4.1.4",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#49b9db5aae8db84ec21231444bf8345d450812b2",
"lbry-redux": "lbryio/lbry-redux#372e559caee6af2b2d927e5d42419a71c3d15b57",
"lbryinc": "lbryio/lbryinc#0b4e41ef90d6347819dd3453f2f9398a5c1b4f36",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",

View file

@ -117,6 +117,28 @@ function CollectionForm(props: Props) {
setParams({ ...params, ...paramObj });
}
// TODO remove this or better decide whether app should delete languages[2+]
// This was added because a previous update setting was duplicating language codes
function dedupeLanguages(languages) {
if (languages.length <= 1) {
return languages;
} else if (languages.length === 2) {
if (languages[0] !== languages[1]) {
return languages;
} else {
return [languages[0]];
}
} else if (languages.length > 2) {
const newLangs = [];
languages.forEach((l) => {
if (!newLangs.includes(l)) {
newLangs.push(l);
}
});
return newLangs;
}
}
function getCollectionParams() {
const collectionParams: {
thumbnail_url?: string,
@ -134,7 +156,7 @@ function CollectionForm(props: Props) {
thumbnail_url: thumbnailUrl,
description,
bid: String(amount || 0.001),
languages: languages || [],
languages: languages ? dedupeLanguages(languages) : [],
locations: locations || [],
tags: tags
? tags.map((tag) => {
@ -175,6 +197,9 @@ function CollectionForm(props: Props) {
langs = [];
} else {
langs[0] = code;
if (langs[0] === langs[1]) {
langs.length = 1;
}
}
} else {
if (code === LANG_NONE || code === langs[0]) {

View file

@ -10139,9 +10139,9 @@ lazy-val@^1.0.4:
yargs "^13.2.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#49b9db5aae8db84ec21231444bf8345d450812b2:
lbry-redux@lbryio/lbry-redux#372e559caee6af2b2d927e5d42419a71c3d15b57:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/49b9db5aae8db84ec21231444bf8345d450812b2"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/372e559caee6af2b2d927e5d42419a71c3d15b57"
dependencies:
"@ungap/from-entries" "^0.2.1"
proxy-polyfill "0.1.6"