diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-06-17 13:54:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-17 13:54:02 +0200 |
commit | 7eec279c7fb0350974fea4456c5c3bab7b457376 (patch) | |
tree | 5744c731973c3f0523f057cd6b96e75785c8de2d | |
parent | 31e5d7efd700547d27d0393264859fa02932a8dd (diff) |
Change language opt-out to language opt-in (#7823)
* Switch filtered_languages to chosen_languages * Adjust interface * Remove unused translations
41 files changed, 32 insertions, 113 deletions
diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index 57793d776..851e62d1b 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -27,7 +27,7 @@ class Settings::PreferencesController < ApplicationController def user_params params.require(:user).permit( :locale, - filtered_languages: [] + chosen_languages: [] ) end diff --git a/app/models/account.rb b/app/models/account.rb index 72e850aa7..c3eea79cc 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -141,7 +141,7 @@ class Account < ApplicationRecord prefix: true, allow_nil: true - delegate :filtered_languages, to: :user, prefix: false, allow_nil: true + delegate :chosen_languages, to: :user, prefix: false, allow_nil: true def local? domain.nil? diff --git a/app/models/status.rb b/app/models/status.rb index 7fa069083..e7dd0df29 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -190,8 +190,8 @@ class Status < ApplicationRecord before_validation :set_local class << self - def not_in_filtered_languages(account) - where(language: nil).or where.not(language: account.filtered_languages) + def in_chosen_languages(account) + where(language: nil).or where(language: account.chosen_languages) end def as_home_timeline(account) @@ -333,7 +333,7 @@ class Status < ApplicationRecord def filter_timeline_for_account(query, account, local_only) query = query.not_excluded_by_account(account) query = query.not_domain_blocked_by_account(account) unless local_only - query = query.not_in_filtered_languages(account) if account.filtered_languages.present? + query = query.in_chosen_languages(account) if account.chosen_languages.present? query.merge(account_silencing_filter(account)) end diff --git a/app/models/user.rb b/app/models/user.rb index 0becfa7e9..c95960dc6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -35,6 +35,7 @@ # moderator :boolean default(FALSE), not null # invite_id :bigint(8) # remember_token :string +# chosen_languages :string is an Array # class User < ApplicationRecord @@ -317,7 +318,9 @@ class User < ApplicationRecord private def sanitize_languages - filtered_languages.reject!(&:blank?) + return if chosen_languages.nil? + chosen_languages.reject!(&:blank?) + self.chosen_languages = nil if chosen_languages.empty? end def prepare_new_user! diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index d2e866373..6ec03ab4b 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -12,7 +12,7 @@ .fields-group = f.input :locale, collection: I18n.available_locales, wrapper: :with_label, include_blank: false, label_method: lambda { |locale| human_locale(locale) }, selected: I18n.locale - = f.input :filtered_languages, collection: filterable_languages, wrapper: :with_block_label, include_blank: false, label_method: lambda { |locale| human_locale(locale) }, required: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' + = f.input :chosen_languages, collection: filterable_languages.sort, wrapper: :with_block_label, include_blank: false, label_method: lambda { |locale| human_locale(locale) }, required: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' %h4= t 'preferences.publishing' diff --git a/config/locales/simple_form.ar.yml b/config/locales/simple_form.ar.yml index e028781fc..06f961341 100644 --- a/config/locales/simple_form.ar.yml +++ b/config/locales/simple_form.ar.yml @@ -23,8 +23,6 @@ ar: data: ملف CSV تم تصديره مِن مثيل خادوم ماستدون آخر sessions: otp: 'قم بإدخال رمز المصادقة بخطوتين الذي قام بتوليده تطبيق جهازك أو إستخدم أحد رموز النفاذ الإحتياطية :' - user: - filtered_languages: سوف يتم تصفية و إخفاء اللغات المختارة من خيوطك العمومية labels: account: fields: @@ -42,7 +40,6 @@ ar: email: عنوان البريد الإلكتروني expires_in: تنتهي مدة صلاحيته بعد fields: واصفات بيانات الملف الشخصي - filtered_languages: اللغات التي تم تصفيتها header: الرأسية locale: اللغة locked: تجميد الحساب diff --git a/config/locales/simple_form.ca.yml b/config/locales/simple_form.ca.yml index 088a6f067..43230e5cf 100644 --- a/config/locales/simple_form.ca.yml +++ b/config/locales/simple_form.ca.yml @@ -23,8 +23,6 @@ ca: data: Fitxer CSV exportat des de una altra instància de Mastodon sessions: otp: 'Introdueix el codi de dos factors generat per el teu telèfon o utilitza un dels teus codis de recuperació:' - user: - filtered_languages: Les llengües seleccionades s'eliminaran de les línies de temps públiques labels: account: fields: @@ -42,7 +40,6 @@ ca: email: Adreça de correu electrònic expires_in: Expira després fields: Metadades del perfil - filtered_languages: Llengües filtrades header: Capçalera locale: Llengua locked: Fes aquest compte privat diff --git a/config/locales/simple_form.co.yml b/config/locales/simple_form.co.yml index 25d4a05fb..ac8b89a7b 100644 --- a/config/locales/simple_form.co.yml +++ b/config/locales/simple_form.co.yml @@ -22,8 +22,6 @@ co: data: Un fugliale CSV da un’altr’istanza di Mastodon sessions: otp: 'Entrate u codice d’identificazione à dui fattori nant’à u vostru telefuninu, o unu di i vostri codici di ricuperazione:' - user: - filtered_languages: Ùn viderete micca e lingue selezziunate nant’à e linee pubbliche labels: account: fields: @@ -40,7 +38,6 @@ co: email: Indirizzu e-mail expires_in: Spira dopu à fields: Metadata di u prufile - filtered_languages: Lingue filtrate header: Ritrattu di cuprendula locale: Lingua locked: Privatizà u contu diff --git a/config/locales/simple_form.de.yml b/config/locales/simple_form.de.yml index c0a451000..f09f717f0 100644 --- a/config/locales/simple_form.de.yml +++ b/config/locales/simple_form.de.yml @@ -22,8 +22,6 @@ de: data: CSV-Datei, die aus einer anderen Mastodon-Instanz exportiert wurde sessions: otp: 'Gib den Zwei-Faktor-Authentisierungscode von deinem Telefon ein oder benutze einen deiner Wiederherstellungscodes:' - user: - filtered_languages: Ausgewählte Sprachen werden aus deinen öffentlichen Zeitleisten gefiltert labels: account: fields: @@ -40,7 +38,6 @@ de: email: E-Mail-Adresse expires_in: Gültig bis fields: Profil-Metadaten - filtered_languages: Gefilterte Sprachen header: Kopfbild locale: Sprache locked: Gesperrtes Profil diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 247a79218..a75a0f567 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -24,7 +24,7 @@ en: sessions: otp: 'Enter the two-factor code generated by your phone app or use one of your recovery codes:' user: - filtered_languages: Checked languages will be filtered from public timelines for you + chosen_languages: Only toots in selected languages will be displayed in public timelines. Select nothing to see toots in all languages labels: account: fields: @@ -34,6 +34,7 @@ en: autofollow: Invite to follow your account avatar: Avatar bot: This is a bot account + chosen_languages: Filter languages confirm_new_password: Confirm new password confirm_password: Confirm password current_password: Current password @@ -42,9 +43,8 @@ en: email: E-mail address expires_in: Expire after fields: Profile metadata - filtered_languages: Filtered languages header: Header - locale: Language + locale: Interface language locked: Lock account max_uses: Max number of uses new_password: New password diff --git a/config/locales/simple_form.eo.yml b/config/locales/simple_form.eo.yml index 4027c1b60..c235929ad 100644 --- a/config/locales/simple_form.eo.yml +++ b/config/locales/simple_form.eo.yml @@ -22,8 +22,6 @@ eo: data: CSV-dosiero el alia nodo de Mastodon sessions: otp: 'Enmetu la kodon de dufaktora aŭtentigo el via telefono aŭ uzu unu el viaj realiraj kodoj:' - user: - filtered_languages: Markitaj lingvoj estos elfiltritaj de publikaj tempolinioj por vi labels: account: fields: @@ -40,7 +38,6 @@ eo: email: Retadreso expires_in: Eksvalidiĝas post fields: Profilaj metadatumoj - filtered_languages: Filtritaj lingvoj header: Fonbildo locale: Lingvo locked: Ŝlosi konton diff --git a/config/locales/simple_form.es.yml b/config/locales/simple_form.es.yml index 38661b00f..000a33edc 100644 --- a/config/locales/simple_form.es.yml +++ b/config/locales/simple_form.es.yml @@ -19,8 +19,6 @@ es: data: Archivo CSV exportado desde otra instancia de Mastodon sessions: otp: Introduce el código de autenticación de dos factores de tu teléfono o usa uno de tus códigos de recuperación. - user: - filtered_languages: Los idiomas seleccionados dejarán de mostrarse para ti en las líneas de tiempo públicas labels: defaults: avatar: Avatar @@ -31,7 +29,6 @@ es: display_name: Nombre para mostrar email: Dirección de correo electrónico expires_in: Expirar tras - filtered_languages: Idiomas filtrados header: Img. cabecera locale: Idioma locked: Hacer privada esta cuenta diff --git a/config/locales/simple_form.eu.yml b/config/locales/simple_form.eu.yml index 364a2e118..f89786dc9 100644 --- a/config/locales/simple_form.eu.yml +++ b/config/locales/simple_form.eu.yml @@ -22,8 +22,6 @@ eu: data: Beste Mastodon instantzia batetik esportatutako CSV fitxategia sessions: otp: 'Sartu zure telefonoko aplikazioak sortutako bi faktoreetako kodea, edo erabili zure berreskuratze kodeetako bat:' - user: - filtered_languages: Ez dira aukeratutako hizkuntzak erakutsiko zure denbora-lerro publikoetan labels: account: fields: @@ -40,7 +38,6 @@ eu: email: E-mail helbidea expires_in: Iraungitzea fields: Profilaren metadatuak - filtered_languages: Iragazitako hizkuntzak header: Goiburua locale: Hizkuntza locked: Giltzapetu kontua diff --git a/config/locales/simple_form.fa.yml b/config/locales/simple_form.fa.yml index 6c72fa7b0..e8a2c38aa 100644 --- a/config/locales/simple_form.fa.yml +++ b/config/locales/simple_form.fa.yml @@ -23,8 +23,6 @@ fa: data: پروندهٔ CSV که از سرور ماستدون دیگری برونسپاری شده sessions: otp: 'کد تأیید دومرحلهای که اپ روی تلفن شما ساخته را وارد کنید یا یکی از کدهای بازیابی را به کار ببرید:' - user: - filtered_languages: زبانهای انتخابشده از فهرست عمومی نوشتههایی که میبینید حذف میشوند labels: account: fields: @@ -42,7 +40,6 @@ fa: email: نشانی ایمیل expires_in: تاریخ انقضا fields: اطلاعات تکمیلی نمایه - filtered_languages: زبانهای فیلترشده header: تصویر زمینه locale: زبان locked: خصوصیکردن حساب diff --git a/config/locales/simple_form.fi.yml b/config/locales/simple_form.fi.yml index b7b97395a..190790ca5 100644 --- a/config/locales/simple_form.fi.yml +++ b/config/locales/simple_form.fi.yml @@ -20,8 +20,6 @@ fi: data: Toisesta Mastodon-instanssista tuotu CSV-tiedosto sessions: otp: Syötä puhelimeen saamasi kaksivaiheisen tunnistautumisen koodi tai käytä palautuskoodia. - user: - filtered_languages: Valitut kielet suodatetaan pois julkisilta aikajanoilta labels: account: fields: @@ -36,7 +34,6 @@ fi: email: Sähköpostiosoite expires_in: Vanhenee fields: Profiilin metadata - filtered_languages: Suodatetut kielet header: Otsakekuva locale: Kieli locked: Lukitse tili diff --git a/config/locales/simple_form.fr.yml b/config/locales/simple_form.fr.yml index 4e535cdf4..8af0201e6 100644 --- a/config/locales/simple_form.fr.yml +++ b/config/locales/simple_form.fr.yml @@ -22,8 +22,6 @@ fr: data: Un fichier CSV généré par une autre instance de Mastodon sessions: otp: 'Entrez le code d’authentification à deux facteurs généré par votre téléphone ou utilisez un de vos codes de récupération :' - user: - filtered_languages: Les langues sélectionnées seront filtrées hors de vos fils publics pour vous labels: account: fields: @@ -40,7 +38,6 @@ fr: email: Adresse courriel expires_in: Expire après fields: Métadonnées du profil - filtered_languages: Langues filtrées header: Image d’en-tête locale: Langue locked: Verrouiller le compte diff --git a/config/locales/simple_form.gl.yml b/config/locales/simple_form.gl.yml index bae49a65d..f621d3587 100644 --- a/config/locales/simple_form.gl.yml +++ b/config/locales/simple_form.gl.yml @@ -22,8 +22,6 @@ gl: data: Ficheiro CSV exportado desde outra instancia Mastodon sessions: otp: Introduza o código de doble-factor xerado no aplicativo do seu móbil ou utilice un dos seus códigos de recuperación. - user: - filtered_languages: Os idiomas marcados filtraranse das liñas temporais públicas para vostede labels: account: fields: @@ -40,7 +38,6 @@ gl: email: enderezo correo electrónico expires_in: Caducidade despois de fields: Metadatos do perfil - filtered_languages: Idiomas filtrados header: Cabeceira locale: Idioma locked: Protexer conta diff --git a/config/locales/simple_form.he.yml b/config/locales/simple_form.he.yml index 20cf1029e..96cdccd2b 100644 --- a/config/locales/simple_form.he.yml +++ b/config/locales/simple_form.he.yml @@ -19,8 +19,6 @@ he: data: קובץ CSV שיוצא משרת מסטודון אחר sessions: otp: נא להקליד קוד אימות דו-שלבי ממכשירך או קוד אחזור גישה. - user: - filtered_languages: שפות שנבחרו יוסתרו מציר הזמן הציבורי בשבילך labels: defaults: avatar: תמונת פרופיל @@ -31,7 +29,6 @@ he: display_name: שם להצגה email: כתובת דוא"ל expires_in: תפוגה לאחר - filtered_languages: שפות מסוננות header: ראשה locale: שפה locked: הפוך חשבון לפרטי diff --git a/config/locales/simple_form.hu.yml b/config/locales/simple_form.hu.yml index 6ec39aa79..2b36dc85b 100644 --- a/config/locales/simple_form.hu.yml +++ b/config/locales/simple_form.hu.yml @@ -19,8 +19,6 @@ hu: data: Egy másik Mastodon szerverről exportált CSV fájl sessions: otp: Add meg a Második-faktor kódodat a telefonodról vagy használd az egyik tartalék bejelentkező kódodat. - user: - filtered_languages: A kiválasztott nyelvek nem jelennek majd meg a nyilvános idővonaladon labels: defaults: avatar: Profilkép @@ -31,7 +29,6 @@ hu: display_name: Megjelenített név email: E-mail cím expires_in: Elévül - filtered_languages: Szűrt nyelvek header: Fejléc locale: Nyelv locked: Zárt felhasználói fiók diff --git a/config/locales/simple_form.it.yml b/config/locales/simple_form.it.yml index cd77bffe3..6a0658395 100644 --- a/config/locales/simple_form.it.yml +++ b/config/locales/simple_form.it.yml @@ -22,8 +22,6 @@ it: data: File CSV esportato da un'altra istanza di Mastodon sessions: otp: 'Inserisci il codice a due fattori generato dall''app del tuo telefono o usa uno dei codici di recupero:' - user: - filtered_languages: Le lingue selezionate verranno filtrate dalla tua timeline pubblica labels: account: fields: @@ -40,7 +38,6 @@ it: email: Indirizzo email expires_in: Scade dopo fields: Metadati del profilo - filtered_languages: Lingue filtrate header: Header locale: Lingua locked: Blocca account diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index 5fa53aaee..dd5caa0ba 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -19,8 +19,6 @@ ja: data: 他の Mastodon インスタンスからエクスポートしたCSVファイルを選択して下さい sessions: otp: '携帯電話のアプリで生成された二段階認証コードを入力するか、リカバリーコードを使用してください:' - user: - filtered_languages: 選択した言語があなたの公開タイムラインから取り除かれます labels: account: fields: @@ -38,7 +36,6 @@ ja: email: メールアドレス expires_in: 有効期限 fields: プロフィール補足情報 - filtered_languages: 除外する言語 header: ヘッダー locale: 言語 locked: 承認制アカウントにする diff --git a/config/locales/simple_form.ko.yml b/config/locales/simple_form.ko.yml index f19800946..421357b49 100644 --- a/config/locales/simple_form.ko.yml +++ b/config/locales/simple_form.ko.yml @@ -23,8 +23,6 @@ ko: data: 다른 마스토돈 인스턴스에서 추출된 CSV 파일 sessions: otp: '휴대전화에서 생성 된 2단계 인증 코드를 입력하거나, 복구 코드 중 하나를 사용하세요:' - user: - filtered_languages: 선택된 언어가 공개 타임라인에서 제외 될 것입니다 labels: account: fields: @@ -42,7 +40,6 @@ ko: email: 이메일 주소 expires_in: 만료시각 fields: 프로필 메타데이터 - filtered_languages: 숨긴 언어들 header: 헤더 locale: 언어 locked: 계정 잠금 diff --git a/config/locales/simple_form.nl.yml b/config/locales/simple_form.nl.yml index 6c7ff4464..f3320f46b 100644 --- a/config/locales/simple_form.nl.yml +++ b/config/locales/simple_form.nl.yml @@ -23,8 +23,6 @@ nl: data: CSV-bestand dat op een andere Mastodonserver werd geëxporteerd sessions: otp: Voer de tweestaps-aanmeldcode vanaf jouw mobiele telefoon in of gebruik een van jouw herstelcodes. - user: - filtered_languages: Geselecteerde talen worden uit de lokale en globale tijdlijn verwijderd labels: account: fields: @@ -42,7 +40,6 @@ nl: email: E-mailadres expires_in: Vervalt na fields: Metadata profiel - filtered_languages: Gefilterde talen header: Omslagfoto locale: Taal locked: Maak account besloten diff --git a/config/locales/simple_form.no.yml b/config/locales/simple_form.no.yml index 48710cabd..aba8feeb6 100644 --- a/config/locales/simple_form.no.yml +++ b/config/locales/simple_form.no.yml @@ -19,8 +19,6 @@ data: CSV-fil eksportert fra en annen Mastodon-instans sessions: otp: Angi tofaktorkoden fra din telefon eller bruk en av dine gjenopprettingskoder. - user: - filtered_languages: Språk som er avhuket vil ikke vises på offentlige tidslinjer fra deg labels: defaults: avatar: Avatar @@ -31,7 +29,6 @@ display_name: Visningsnavn email: E-postadresse expires_in: Utløper etter - filtered_languages: Filtrerte språk header: Overskrift locale: Språk locked: Lås konto diff --git a/config/locales/simple_form.oc.yml b/config/locales/simple_form.oc.yml index f21852fbb..510e76e38 100644 --- a/config/locales/simple_form.oc.yml +++ b/config/locales/simple_form.oc.yml @@ -23,8 +23,6 @@ oc: data: Fichièr CSV exportat d’una autra instància Mastodon sessions: otp: 'Picatz lo còdi d’autentificacion en dos temps (Two factor code) de vòstra aplicacion mobil o utilizatz un de vòstres còdis de recuperacion :' - user: - filtered_languages: Las lengas seleccionadas seràn levadas de vòstre flux d’actualitat labels: account: fields: @@ -42,7 +40,6 @@ oc: email: Corrièl expires_in: Expira aprèp fields: Metadonada del perfil - filtered_languages: Lengas filtradas header: Bandièra locale: Lenga locked: Far venir lo compte privat diff --git a/config/locales/simple_form.pl.yml b/config/locales/simple_form.pl.yml index 66f2a0f0b..274af2b73 100644 --- a/config/locales/simple_form.pl.yml +++ b/config/locales/simple_form.pl.yml @@ -26,8 +26,6 @@ pl: data: Plik CSV wyeksportowany z innej instancji Mastodona sessions: otp: 'Wprowadź kod weryfikacji dwuetapowej z telefonu lub wykorzystaj jeden z kodów zapasowych:' - user: - filtered_languages: Wpisy w wybranych językach nie będą wyświetlać się na publicznych osiach czasu labels: account: fields: @@ -44,7 +42,6 @@ pl: email: Adres e-mail expires_in: Wygaśnie po fields: Metadane profilu - filtered_languages: Filtrowane języki header: Nagłówek locale: Język locked: Ustaw konto jako prywatne diff --git a/config/locales/simple_form.pt-BR.yml b/config/locales/simple_form.pt-BR.yml index 50ed5eb1a..cec96739f 100644 --- a/config/locales/simple_form.pt-BR.yml +++ b/config/locales/simple_form.pt-BR.yml @@ -22,8 +22,6 @@ pt-BR: data: Arquivo CSV exportado de outra instância do Mastodon sessions: otp: 'Insira o código de autenticação gerado pelo app no seu celular ou use um dos códigos de recuperação:' - user: - filtered_languages: Selecione os idiomas que devem ser removidos de suas timelines públicas labels: account: fields: @@ -40,7 +38,6 @@ pt-BR: email: Endereço de e-mail expires_in: Expira em fields: Metadados do perfil - filtered_languages: Idiomas filtrados header: Cabeçalho locale: Idioma locked: Trancar conta diff --git a/config/locales/simple_form.pt.yml b/config/locales/simple_form.pt.yml index 67fed495c..5b79bd29f 100644 --- a/config/locales/simple_form.pt.yml +++ b/config/locales/simple_form.pt.yml @@ -19,8 +19,6 @@ pt: data: Arquivo CSV exportado de outra instância do Mastodon sessions: otp: Inserir o código de autenticação de dois factores do teu telemóvel ou usa um dos códigos de recuperação. - user: - filtered_languages: Seleciona os idiomas que devem ser removidos das tuas timelines públicas labels: defaults: avatar: Imagem de Perfil @@ -31,7 +29,6 @@ pt: display_name: Nome Público email: Endereço de e-mail expires_in: Expira em - filtered_languages: Idiomas filtrados header: Cabeçalho locale: Idioma locked: Trancar conta diff --git a/config/locales/simple_form.ru.yml b/config/locales/simple_form.ru.yml index a6b50b9d2..6bb95b13f 100644 --- a/config/locales/simple_form.ru.yml +++ b/config/locales/simple_form.ru.yml @@ -26,8 +26,6 @@ ru: data: Файл CSV, экспортированный с другого узла Mastodon sessions: otp: 'Введите код двухфакторной аутентификации, сгенерированный в мобильном приложении, или используйте один из Ваших кодов восстановления:' - user: - filtered_languages: Выбранные языки будут убраны из Ваших публичных лет. labels: account: fields: @@ -44,7 +42,6 @@ ru: email: Адрес e-mail expires_in: Срок действия fields: Метаданные профиля - filtered_languages: Фильтруемые языки header: Заголовок locale: Язык locked: Сделать аккаунт закрытым diff --git a/config/locales/simple_form.sk.yml b/config/locales/simple_form.sk.yml index 74cb3ac56..279e9a967 100644 --- a/config/locales/simple_form.sk.yml +++ b/config/locales/simple_form.sk.yml @@ -25,8 +25,6 @@ sk: data: CSV súbor vyexportovaný z inej Mastodon inštancie sessions: otp: 'Napíš sem dvoj-faktorový kód z telefónu, alebo použi jeden z tvojích obnovovacích kódov:' - user: - filtered_languages: Zaškrtnuté jazyky budú pre teba vynechané z verejnej časovej osi labels: account: fields: @@ -44,7 +42,6 @@ sk: email: Emailová adresa expires_in: Expirovať po fields: Metadáta profilu - filtered_languages: Vynechanie jazykov header: Obrázok v hlavičke locale: Jazyk locked: Zamknúť účet diff --git a/config/locales/simple_form.sr-Latn.yml b/config/locales/simple_form.sr-Latn.yml index 30f7eada7..608630c0c 100644 --- a/config/locales/simple_form.sr-Latn.yml +++ b/config/locales/simple_form.sr-Latn.yml @@ -23,8 +23,6 @@ sr-Latn: data: CSV fajl izvezen sa druge Mastodont instance sessions: otp: Unesite dvofaktorski kod sa Vašeg telefona ili koristite jedan od kodova za oporavak. - user: - filtered_languages: Označeni jezici će za Vas biti isfiltrirani sa javnih lajni labels: defaults: avatar: Avatar @@ -35,7 +33,6 @@ sr-Latn: display_name: Ime za prikaz email: Adresa e-pošte expires_in: Ističe nakon - filtered_languages: Filtrirani jezici header: Zaglavlje locale: Jezik locked: Zaključaj nalog diff --git a/config/locales/simple_form.sr.yml b/config/locales/simple_form.sr.yml index 3345f7b41..ab9ef0f49 100644 --- a/config/locales/simple_form.sr.yml +++ b/config/locales/simple_form.sr.yml @@ -23,8 +23,6 @@ sr: data: CSV фајл извезен са друге Мастодонт инстанце sessions: otp: Унесите двофакторски код са Вашег телефона или користите један од кодова за опоравак. - user: - filtered_languages: Означени језици ће за Вас бити исфилтрирани са јавних лајни labels: defaults: avatar: Аватар @@ -35,7 +33,6 @@ sr: display_name: Име за приказ email: Адреса е-поште expires_in: Истиче након - filtered_languages: Филтрирани језици header: Заглавље locale: Језик locked: Закључај налог diff --git a/config/locales/simple_form.sv.yml b/config/locales/simple_form.sv.yml index f027d684b..346ab3931 100644 --- a/config/locales/simple_form.sv.yml +++ b/config/locales/simple_form.sv.yml @@ -22,8 +22,6 @@ sv: data: CSV-fil som exporteras från en annan Mastodon-instans sessions: otp: 'Ange tvåfaktorkoden genererad från din telefonapp eller använd någon av dina återställningskoder:' - user: - filtered_languages: Kontrollerade språk filtreras från offentliga tidslinjer för dig labels: account: fields: @@ -40,7 +38,6 @@ sv: email: E-postadress expires_in: Förfaller efter fields: Profil-metadata - filtered_languages: Filtrerade språk header: Bakgrundsbild locale: Språk locked: Lås konto diff --git a/config/locales/simple_form.zh-CN.yml b/config/locales/simple_form.zh-CN.yml index 3a315a7db..f1947e961 100644 --- a/config/locales/simple_form.zh-CN.yml +++ b/config/locales/simple_form.zh-CN.yml @@ -19,8 +19,6 @@ zh-CN: data: 请上传从其他 Mastodon 实例导出的 CSV 文件 sessions: otp: 输入你手机应用上生成的双重认证码,或者任意一个恢复代码: - user: - filtered_languages: 被勾选语言的嘟文将不会出现在你的公共时间轴上 labels: account: fields: @@ -38,7 +36,6 @@ zh-CN: email: 电子邮件地址 expires_in: 失效时间 fields: 个人资料附加信息 - filtered_languages: 语言过滤 header: 个人资料页横幅图片 locale: 语言 locked: 保护你的帐户(锁嘟) diff --git a/config/locales/simple_form.zh-HK.yml b/config/locales/simple_form.zh-HK.yml index 06d3f6f6c..7a1cae68d 100644 --- a/config/locales/simple_form.zh-HK.yml +++ b/config/locales/simple_form.zh-HK.yml @@ -22,8 +22,6 @@ zh-HK: data: 自其他服務站匯出的 CSV 檔案 sessions: otp: 輸入你手機上生成的雙重認證碼,或者任意一個恢復代碼: - user: - filtered_languages: 下面被選擇的語言的文章將不會出現在你的公共時間軸上 labels: account: fields: @@ -40,7 +38,6 @@ zh-HK: email: 電郵地址 expires_in: 失效時間 fields: 資料 - filtered_languages: 封鎖下面語言的文章 header: 個人頁面頂部 locale: 語言 locked: 將用戶轉為「私人」 diff --git a/config/locales/simple_form.zh-TW.yml b/config/locales/simple_form.zh-TW.yml index c7c5a37f0..a3f6627af 100644 --- a/config/locales/simple_form.zh-TW.yml +++ b/config/locales/simple_form.zh-TW.yml @@ -10,8 +10,6 @@ zh-TW: note: 最多 160 個字元 imports: data: 自其他服務站匯出的 CSV 檔案 - user: - filtered_languages: 下面被選擇的語言的文章將不會出現在你的公共時間軸上。 labels: defaults: avatar: 大頭貼 @@ -21,7 +19,6 @@ zh-TW: data: 資料 display_name: 顯示名稱 email: 電子信箱 - filtered_languages: 封鎖下面語言的文章 header: 個人頁面頂部 locale: 語言 locked: 將帳號轉為「私密」 diff --git a/db/migrate/20180616192031_add_chosen_languages_to_users.rb b/db/migrate/20180616192031_add_chosen_languages_to_users.rb new file mode 100644 index 000000000..48b53019d --- /dev/null +++ b/db/migrate/20180616192031_add_chosen_languages_to_users.rb @@ -0,0 +1,5 @@ +class AddChosenLanguagesToUsers < ActiveRecord::Migration[5.2] + def change + add_column :users, :chosen_languages, :string, array: true, null: true, default: nil + end +end diff --git a/db/schema.rb b/db/schema.rb index 4c39de26a..c06387ba6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_06_15_122121) do +ActiveRecord::Schema.define(version: 2018_06_16_192031) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -525,6 +525,7 @@ ActiveRecord::Schema.define(version: 2018_06_15_122121) do t.boolean "moderator", default: false, null: false t.bigint "invite_id" t.string "remember_token" + t.string "chosen_languages", array: true t.index ["account_id"], name: "index_users_on_account_id" t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["email"], name: "index_users_on_email", unique: true diff --git a/spec/controllers/settings/preferences_controller_spec.rb b/spec/controllers/settings/preferences_controller_spec.rb index 7877c7362..f2028cf39 100644 --- a/spec/controllers/settings/preferences_controller_spec.rb +++ b/spec/controllers/settings/preferences_controller_spec.rb @@ -18,12 +18,12 @@ describe Settings::PreferencesController do describe 'PUT #update' do it 'updates the user record' do - put :update, params: { user: { locale: 'en', filtered_languages: ['es', 'fr', ''] } } + put :update, params: { user: { locale: 'en', chosen_languages: ['es', 'fr', ''] } } expect(response).to redirect_to(settings_preferences_path) user.reload expect(user.locale).to eq 'en' - expect(user.filtered_languages).to eq ['es', 'fr'] + expect(user.chosen_languages).to eq ['es', 'fr'] end it 'updates user settings' do diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index 5113b652f..b3e475d99 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -259,18 +259,18 @@ RSpec.describe Status, type: :model do end end - describe '.not_in_filtered_languages' do + describe '.in_chosen_languages' do context 'for accounts with language filters' do - let(:user) { Fabricate(:user, filtered_languages: ['en']) } + let(:user) { Fabricate(:user, chosen_languages: ['en']) } - it 'does not include statuses in filtered languages' do - status = Fabricate(:status, language: 'en') - expect(Status.not_in_filtered_languages(user.account)).not_to include status + it 'does not include statuses in not in chosen languages' do + status = Fabricate(:status, language: 'de') + expect(Status.in_chosen_languages(user.account)).not_to include status end it 'includes status with unknown language' do status = Fabricate(:status, language: nil) - expect(Status.not_in_filtered_languages(user.account)).to include status + expect(Status.in_chosen_languages(user.account)).to include status end end end @@ -518,7 +518,7 @@ RSpec.describe Status, type: :model do context 'with language preferences' do it 'excludes statuses in languages not allowed by the account user' do - user = Fabricate(:user, filtered_languages: [:fr]) + user = Fabricate(:user, chosen_languages: [:en, :es]) @account.update(user: user) en_status = Fabricate(:status, language: 'en') es_status = Fabricate(:status, language: 'es') @@ -531,7 +531,7 @@ RSpec.describe Status, type: :model do end it 'includes all languages when user does not have a setting' do - user = Fabricate(:user, filtered_languages: []) + user = Fabricate(:user, chosen_languages: nil) @account.update(user: user) en_status = Fabricate(:status, language: 'en') diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index cc8d88cc8..93a6c26fb 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -41,9 +41,9 @@ RSpec.describe User, type: :model do end it 'cleans out empty string from languages' do - user = Fabricate.build(:user, filtered_languages: ['']) + user = Fabricate.build(:user, chosen_languages: ['']) user.valid? - expect(user.filtered_languages).to eq [] + expect(user.chosen_languages).to eq nil end end |