Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change language opt-out to language opt-in #7823

Merged
merged 3 commits into from Jun 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/settings/preferences_controller.rb
Expand Up @@ -27,7 +27,7 @@ def user_settings
def user_params
params.require(:user).permit(
:locale,
filtered_languages: []
chosen_languages: []
)
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/account.rb
Expand Up @@ -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?
Expand Down
6 changes: 3 additions & 3 deletions app/models/status.rb
Expand Up @@ -190,8 +190,8 @@ def marked_for_mass_destruction?
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)
Expand Down Expand Up @@ -333,7 +333,7 @@ def apply_timeline_filters(query, account, local_only)
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

Expand Down
5 changes: 4 additions & 1 deletion app/models/user.rb
Expand Up @@ -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
Expand Down Expand Up @@ -317,7 +318,9 @@ def send_devise_notification(notification, *args)
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!
Expand Down
2 changes: 1 addition & 1 deletion app/views/settings/preferences/show.html.haml
Expand Up @@ -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'

Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.ar.yml
Expand Up @@ -23,8 +23,6 @@ ar:
data: ملف CSV تم تصديره مِن مثيل خادوم ماستدون آخر
sessions:
otp: 'قم بإدخال رمز المصادقة بخطوتين الذي قام بتوليده تطبيق جهازك أو إستخدم أحد رموز النفاذ الإحتياطية :'
user:
filtered_languages: سوف يتم تصفية و إخفاء اللغات المختارة من خيوطك العمومية
labels:
account:
fields:
Expand All @@ -42,7 +40,6 @@ ar:
email: عنوان البريد الإلكتروني
expires_in: تنتهي مدة صلاحيته بعد
fields: واصفات بيانات الملف الشخصي
filtered_languages: اللغات التي تم تصفيتها
header: الرأسية
locale: اللغة
locked: تجميد الحساب
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.ca.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.co.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.de.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions config/locales/simple_form.en.yml
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.eo.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.es.yml
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.eu.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.fa.yml
Expand Up @@ -23,8 +23,6 @@ fa:
data: پروندهٔ CSV که از سرور ماستدون دیگری برون‌سپاری شده
sessions:
otp: 'کد تأیید دومرحله‌ای که اپ روی تلفن شما ساخته را وارد کنید یا یکی از کدهای بازیابی را به کار ببرید:'
user:
filtered_languages: زبان‌های انتخاب‌شده از فهرست عمومی نوشته‌هایی که می‌بینید حذف می‌شوند
labels:
account:
fields:
Expand All @@ -42,7 +40,6 @@ fa:
email: نشانی ایمیل
expires_in: تاریخ انقضا
fields: اطلاعات تکمیلی نمایه
filtered_languages: زبان‌های فیلترشده
header: تصویر زمینه
locale: زبان
locked: خصوصی‌کردن حساب
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.fi.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.fr.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.gl.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.he.yml
Expand Up @@ -19,8 +19,6 @@ he:
data: קובץ CSV שיוצא משרת מסטודון אחר
sessions:
otp: נא להקליד קוד אימות דו-שלבי ממכשירך או קוד אחזור גישה.
user:
filtered_languages: שפות שנבחרו יוסתרו מציר הזמן הציבורי בשבילך
labels:
defaults:
avatar: תמונת פרופיל
Expand All @@ -31,7 +29,6 @@ he:
display_name: שם להצגה
email: כתובת דוא"ל
expires_in: תפוגה לאחר
filtered_languages: שפות מסוננות
header: ראשה
locale: שפה
locked: הפוך חשבון לפרטי
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.hu.yml
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.it.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.ja.yml
Expand Up @@ -19,8 +19,6 @@ ja:
data: 他の Mastodon インスタンスからエクスポートしたCSVファイルを選択して下さい
sessions:
otp: '携帯電話のアプリで生成された二段階認証コードを入力するか、リカバリーコードを使用してください:'
user:
filtered_languages: 選択した言語があなたの公開タイムラインから取り除かれます
labels:
account:
fields:
Expand All @@ -38,7 +36,6 @@ ja:
email: メールアドレス
expires_in: 有効期限
fields: プロフィール補足情報
filtered_languages: 除外する言語
header: ヘッダー
locale: 言語
locked: 承認制アカウントにする
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.ko.yml
Expand Up @@ -23,8 +23,6 @@ ko:
data: 다른 마스토돈 인스턴스에서 추출된 CSV 파일
sessions:
otp: '휴대전화에서 생성 된 2단계 인증 코드를 입력하거나, 복구 코드 중 하나를 사용하세요:'
user:
filtered_languages: 선택된 언어가 공개 타임라인에서 제외 될 것입니다
labels:
account:
fields:
Expand All @@ -42,7 +40,6 @@ ko:
email: 이메일 주소
expires_in: 만료시각
fields: 프로필 메타데이터
filtered_languages: 숨긴 언어들
header: 헤더
locale: 언어
locked: 계정 잠금
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.nl.yml
Expand Up @@ -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:
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/locales/simple_form.no.yml
Expand Up @@ -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
Expand All @@ -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
Expand Down