From 7e87d27edc6848cd0cde0c309988cfe520fa4392 Mon Sep 17 00:00:00 2001 From: Andrea Vos Date: Tue, 7 Sep 2021 20:18:01 +0200 Subject: [PATCH 1/8] =?UTF-8?q?[pl]=20u=C5=BCytkownik=20->=20u=C5=BCytkown?= =?UTF-8?q?icze?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locale/pl/translations.suml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/locale/pl/translations.suml b/locale/pl/translations.suml index 84dc27b76..a0834b6f7 100644 --- a/locale/pl/translations.suml +++ b/locale/pl/translations.suml @@ -570,7 +570,7 @@ faq: Dziś feminatywy są używane coraz częściej, i mało kogo jeszcze dziwią czy bulwersują. Z neutratywami i niebinarnymi formami językowymi może być podobnie. - > - Język jest żywy. Ewoluuje i dostosuje się do zmieniających się potrzeb jego użytkowników. + Język jest żywy. Ewoluuje i dostosuje się do zmieniających się potrzeb osób go używających. Język nie jest danym z niebios magicznym przykazaniem wyrytym w kamieniu – jest jedynie narzędziem do porozumiewania się. Może, powinien, i będzie się zmieniał – czy tego chcesz czy nie. @@ -991,10 +991,10 @@ user: headerLong: 'Twoje konto' tokenExpired: 'Sesja wygasła. Odśwież stronę i spróbuj ponownie.' login: - placeholder: 'Email (lub nazwa użytkownika, jeśli już posiadasz konto)' + placeholder: 'Email (lub nazwa użytkownicza, jeśli już posiadasz konto)' action: 'Zaloguj' emailSent: 'Na Twój adres wysłałośmy email z sześciocyfrowym kodem. Wpisz go poniżej. Kod jest jednorazowy i ważny przez 15 minut.' - userNotFound: 'Użytkownik nie został znaleziony.' + userNotFound: 'Konto nie zostało znalezione.' email: subject: 'Twój kod logowania to %code%' content: | @@ -1009,10 +1009,10 @@ user: invalid: 'Kod nieprawidłowy.' account: changeUsername: - header: 'Nazwa użytkownika' + header: 'Nazwa użytkownicza' action: 'Zmień' - invalid: 'Nazwa użytkownika musi mieć od 4 do 16 znaków i zawierać wyłącznie cyfry, litery, kropkę, myślnik i podłogę.' - taken: 'Ta nazwa użytkownika jest zajęta.' + invalid: 'Nazwa użytkownicza musi mieć od 4 do 16 znaków i zawierać wyłącznie cyfry, litery, kropkę, myślnik i podłogę.' + taken: 'Ta nazwa użytkownicza jest zajęta.' changeEmail: header: 'Adres email' action: 'Zmień' @@ -1382,7 +1382,7 @@ calendar: nonbinary_parents_day: '{https://www.familyequality.org/2021/04/16/celebrating-nonbinary-parents-day-with-founder-johnny-blazes/=Dzień Rodzicielstwa Osób Niebinarnych}' trans_prisoner: '{https://transprisoners.net/about/=Dzień Solidarności z Uwięzionymi Osobami Trans}' xenogender_day: 'Dzień Widoczności {/terminologia#ksenopłciowość=Osób Ksenopłciowych}' - banner: 'Obchodzimy właśnie' + banner: 'Dziś w kalendarzu' image: header: 'Ściągnij w formie obrazka' overview: 'Przegląd' From 86c053f033318b22916b393bd6803780acf4937c Mon Sep 17 00:00:00 2001 From: Andrea Vos Date: Tue, 7 Sep 2021 21:01:41 +0200 Subject: [PATCH 2/8] #264 [sources] handle multiple translations of the same source --- server/routes/sources.js | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/server/routes/sources.js b/server/routes/sources.js index 563a3b9d2..059479d6f 100644 --- a/server/routes/sources.js +++ b/server/routes/sources.js @@ -19,28 +19,38 @@ const approve = async (db, id) => { `); } -const linkOtherVersions = async (req, sources) => { - const keys = new Set(sources.filter(s => !!s && s.key).map(s => `'` + clearKey(s.key) + `'`)); +const keyGetMain = (key) => { + return key.split('/')[0]; +} - const otherVersions = await req.db.all(SQL` +const linkOtherVersions = async (req, sources) => { + const keys = new Set(sources.filter(s => !!s && s.key).map(s => keyGetMain(clearKey(s.key)))); + + let sql = SQL` SELECT s.*, u.username AS submitter FROM sources s LEFT JOIN users u ON s.submitter_id = u.id WHERE s.locale != ${global.config.locale} AND s.deleted = 0 AND s.approved >= ${req.isGranted('sources') ? 0 : 1} - AND s.key IN (`.append([...keys].join(',')).append(SQL`) - `)); + AND (`; + for (let key of keys) { + sql = sql.append(SQL`s.key = ${key} OR s.key LIKE ${key + '/%'} OR `) + } + sql = sql.append(SQL`0=1)`); + + const otherVersions = await req.db.all(sql); const otherVersionsMap = {}; otherVersions.forEach(version => { - if (otherVersionsMap[version.key] === undefined) { - otherVersionsMap[version.key] = []; + const k = keyGetMain(version.key); + if (otherVersionsMap[k] === undefined) { + otherVersionsMap[k] = []; } - otherVersionsMap[version.key].push(version); + otherVersionsMap[k].push(version); }); return sources.map(s => { - s.versions = s.key ? otherVersionsMap[s.key] || [] : []; + s.versions = s.key ? otherVersionsMap[keyGetMain(s.key)] || [] : []; return s; }); }; From c328d3619fed838b5e36806cf13ba14495d81db3 Mon Sep 17 00:00:00 2001 From: Andrea Vos Date: Tue, 7 Sep 2021 22:21:30 +0200 Subject: [PATCH 3/8] [user][bug] allow changing username to the same one but with different capitalisation --- components/Account.vue | 6 +++++- server/routes/user.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/Account.vue b/components/Account.vue index 89d371b46..85f48b7c7 100644 --- a/components/Account.vue +++ b/components/Account.vue @@ -59,7 +59,7 @@
-
@@ -148,6 +148,7 @@ import {socialProviders} from "../src/data"; import {gravatar} from "../src/helpers"; import cookieSettings from "../src/cookieSettings"; + import {mapState} from "vuex"; export default { data() { @@ -284,6 +285,9 @@ }, }, computed: { + ...mapState([ + 'user', + ]), canChangeEmail() { return this.email && this.captchaToken; } diff --git a/server/routes/user.js b/server/routes/user.js index 8a7a30366..a8f352a7c 100644 --- a/server/routes/user.js +++ b/server/routes/user.js @@ -292,7 +292,7 @@ router.post('/user/change-username', handleErrorAsync(async (req, res) => { } const dbUser = await req.db.get(SQL`SELECT * FROM users WHERE usernameNorm = ${normalise(req.body.username)}`); - if (dbUser) { + if (dbUser && dbUser.id !== req.user.id) { return res.json({ error: 'user.account.changeUsername.taken' }) } From f9ec79f401279bb8a3b4bfb9b1af3d9517fffb3a Mon Sep 17 00:00:00 2001 From: Andrea Vos Date: Tue, 7 Sep 2021 22:35:40 +0200 Subject: [PATCH 4/8] [terms] allow paragraphs --- components/Term.vue | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/components/Term.vue b/components/Term.vue index 6911c61f2..0b24aba16 100644 --- a/components/Term.vue +++ b/components/Term.vue @@ -1,13 +1,16 @@ + + diff --git a/locale/de/config.suml b/locale/de/config.suml index 2d4eebbfe..b2f4f6811 100644 --- a/locale/de/config.suml +++ b/locale/de/config.suml @@ -132,16 +132,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true diff --git a/locale/en/config.suml b/locale/en/config.suml index add533e17..0ca8bfa51 100644 --- a/locale/en/config.suml +++ b/locale/en/config.suml @@ -224,16 +224,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true diff --git a/locale/es/config.suml b/locale/es/config.suml index a82989c4e..79e96a5ce 100644 --- a/locale/es/config.suml +++ b/locale/es/config.suml @@ -139,16 +139,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true diff --git a/locale/fr/config.suml b/locale/fr/config.suml index 3cfd04168..c18a4deef 100644 --- a/locale/fr/config.suml +++ b/locale/fr/config.suml @@ -113,16 +113,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true diff --git a/locale/nl/config.suml b/locale/nl/config.suml index ce92e3a5b..6121555bd 100644 --- a/locale/nl/config.suml +++ b/locale/nl/config.suml @@ -114,16 +114,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true diff --git a/locale/no/config.suml b/locale/no/config.suml index 33277050f..5bb08da0d 100644 --- a/locale/no/config.suml +++ b/locale/no/config.suml @@ -116,16 +116,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true diff --git a/locale/pl/config.suml b/locale/pl/config.suml index b25d06116..80708d7c4 100644 --- a/locale/pl/config.suml +++ b/locale/pl/config.suml @@ -1038,16 +1038,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true diff --git a/locale/pt/config.suml b/locale/pt/config.suml index d4d029294..0dcddea32 100644 --- a/locale/pt/config.suml +++ b/locale/pt/config.suml @@ -109,16 +109,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true diff --git a/locale/yi/config.suml b/locale/yi/config.suml index b5ed7795f..e254506cf 100644 --- a/locale/yi/config.suml +++ b/locale/yi/config.suml @@ -189,16 +189,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true diff --git a/locale/zh/config.suml b/locale/zh/config.suml index 706e9dea2..40c7b48ad 100644 --- a/locale/zh/config.suml +++ b/locale/zh/config.suml @@ -120,16 +120,7 @@ contact: support: enabled: true - links: - - - icon: 'coffee' - url: 'https://ko-fi.com/radajezykaneutralnego' - headline: 'Ko-Fi' - - - icon: 'paypal' - iconSet: 'b' - url: 'https://paypal.me/RJNeutralnego' - headline: 'PayPal' + links: [] user: enabled: true