From f556f79b7733834430b93109ac2c7f87529c8574 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 12 Mar 2020 17:57:59 +0100 Subject: [PATCH] Add titles to warning presets in admin UI (#13252) --- .../admin/warning_presets_controller.rb | 6 ++--- app/models/account_warning_preset.rb | 3 +++ app/views/admin/account_actions/new.html.haml | 2 +- .../warning_presets/_warning_preset.html.haml | 10 ++++++++ .../admin/warning_presets/edit.html.haml | 3 +++ .../admin/warning_presets/index.html.haml | 24 +++++++------------ config/locales/ar.yml | 1 - config/locales/ca.yml | 1 - config/locales/co.yml | 1 - config/locales/cs.yml | 1 - config/locales/cy.yml | 1 - config/locales/da.yml | 1 - config/locales/de.yml | 1 - config/locales/el.yml | 1 - config/locales/en.yml | 1 - config/locales/en_GB.yml | 1 - config/locales/eo.yml | 1 - config/locales/es-AR.yml | 1 - config/locales/es.yml | 1 - config/locales/et.yml | 1 - config/locales/eu.yml | 1 - config/locales/fa.yml | 1 - config/locales/fr.yml | 1 - config/locales/gl.yml | 1 - config/locales/hu.yml | 1 - config/locales/id.yml | 1 - config/locales/is.yml | 1 - config/locales/it.yml | 1 - config/locales/ja.yml | 1 - config/locales/kab.yml | 1 - config/locales/kk.yml | 1 - config/locales/ko.yml | 1 - config/locales/lt.yml | 1 - config/locales/nl.yml | 1 - config/locales/nn.yml | 1 - config/locales/no.yml | 1 - config/locales/oc.yml | 1 - config/locales/pl.yml | 1 - config/locales/pt-BR.yml | 1 - config/locales/pt-PT.yml | 1 - config/locales/ru.yml | 1 - config/locales/simple_form.en.yml | 2 ++ config/locales/sk.yml | 1 - config/locales/sl.yml | 1 - config/locales/sq.yml | 1 - config/locales/sr.yml | 1 - config/locales/sv.yml | 1 - config/locales/th.yml | 1 - config/locales/tr.yml | 1 - config/locales/uk.yml | 1 - config/locales/vi.yml | 1 - config/locales/zh-CN.yml | 1 - config/locales/zh-HK.yml | 1 - config/locales/zh-TW.yml | 1 - ...58_add_title_to_account_warning_presets.rb | 15 ++++++++++++ db/schema.rb | 3 ++- 56 files changed, 48 insertions(+), 67 deletions(-) create mode 100644 app/views/admin/warning_presets/_warning_preset.html.haml create mode 100644 db/migrate/20200312144258_add_title_to_account_warning_presets.rb diff --git a/app/controllers/admin/warning_presets_controller.rb b/app/controllers/admin/warning_presets_controller.rb index 37be842c5..b376f8d9b 100644 --- a/app/controllers/admin/warning_presets_controller.rb +++ b/app/controllers/admin/warning_presets_controller.rb @@ -7,7 +7,7 @@ module Admin def index authorize :account_warning_preset, :index? - @warning_presets = AccountWarningPreset.all + @warning_presets = AccountWarningPreset.alphabetic @warning_preset = AccountWarningPreset.new end @@ -19,7 +19,7 @@ module Admin if @warning_preset.save redirect_to admin_warning_presets_path else - @warning_presets = AccountWarningPreset.all + @warning_presets = AccountWarningPreset.alphabetic render :index end end @@ -52,7 +52,7 @@ module Admin end def warning_preset_params - params.require(:account_warning_preset).permit(:text) + params.require(:account_warning_preset).permit(:title, :text) end end end diff --git a/app/models/account_warning_preset.rb b/app/models/account_warning_preset.rb index ba8ceabb3..c20f683cf 100644 --- a/app/models/account_warning_preset.rb +++ b/app/models/account_warning_preset.rb @@ -8,8 +8,11 @@ # text :text default(""), not null # created_at :datetime not null # updated_at :datetime not null +# title :string default(""), not null # class AccountWarningPreset < ApplicationRecord validates :text, presence: true + + scope :alphabetic, -> { order(title: :asc, text: :asc) } end diff --git a/app/views/admin/account_actions/new.html.haml b/app/views/admin/account_actions/new.html.haml index 20fbeef33..aa88b1448 100644 --- a/app/views/admin/account_actions/new.html.haml +++ b/app/views/admin/account_actions/new.html.haml @@ -21,7 +21,7 @@ - unless @warning_presets.empty? .fields-group - = f.input :warning_preset_id, collection: @warning_presets, label_method: :text, wrapper: :with_block_label + = f.input :warning_preset_id, collection: @warning_presets, label_method: ->(warning_preset) { [warning_preset.title.presence, truncate(warning_preset.text)].compact.join(' - ') }, wrapper: :with_block_label .fields-group = f.input :text, as: :text, wrapper: :with_block_label, hint: t('simple_form.hints.admin_account_action.text_html', path: admin_warning_presets_path) diff --git a/app/views/admin/warning_presets/_warning_preset.html.haml b/app/views/admin/warning_presets/_warning_preset.html.haml new file mode 100644 index 000000000..a58199c80 --- /dev/null +++ b/app/views/admin/warning_presets/_warning_preset.html.haml @@ -0,0 +1,10 @@ +.announcements-list__item + = link_to edit_admin_warning_preset_path(warning_preset), class: 'announcements-list__item__title' do + = warning_preset.title.presence || truncate(warning_preset.text) + + .announcements-list__item__action-bar + .announcements-list__item__meta + = truncate(warning_preset.text) + + %div + = table_link_to 'trash', t('admin.warning_presets.delete'), admin_warning_preset_path(warning_preset), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, warning_preset) diff --git a/app/views/admin/warning_presets/edit.html.haml b/app/views/admin/warning_presets/edit.html.haml index 9522746cd..b5c5107ef 100644 --- a/app/views/admin/warning_presets/edit.html.haml +++ b/app/views/admin/warning_presets/edit.html.haml @@ -4,6 +4,9 @@ = simple_form_for @warning_preset, url: admin_warning_preset_path(@warning_preset) do |f| = render 'shared/error_messages', object: @warning_preset + .fields-group + = f.input :title, wrapper: :with_block_label + .fields-group = f.input :text, wrapper: :with_block_label diff --git a/app/views/admin/warning_presets/index.html.haml b/app/views/admin/warning_presets/index.html.haml index 45913ef73..dbc23fa30 100644 --- a/app/views/admin/warning_presets/index.html.haml +++ b/app/views/admin/warning_presets/index.html.haml @@ -5,6 +5,9 @@ = simple_form_for @warning_preset, url: admin_warning_presets_path do |f| = render 'shared/error_messages', object: @warning_preset + .fields-group + = f.input :title, wrapper: :with_block_label + .fields-group = f.input :text, wrapper: :with_block_label @@ -13,18 +16,9 @@ %hr.spacer/ -- unless @warning_presets.empty? - .table-wrapper - %table.table - %thead - %tr - %th= t('simple_form.labels.account_warning_preset.text') - %th - %tbody - - @warning_presets.each do |preset| - %tr - %td - = Formatter.instance.linkify(preset.text) - %td - = table_link_to 'pencil', t('admin.warning_presets.edit'), edit_admin_warning_preset_path(preset) - = table_link_to 'trash', t('admin.warning_presets.delete'), admin_warning_preset_path(preset), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } +- if @warning_presets.empty? + %div.muted-hint.center-text + = t 'admin.warning_presets.empty' +- else + .announcements-list + = render partial: 'warning_preset', collection: @warning_presets diff --git a/config/locales/ar.yml b/config/locales/ar.yml index f5a6f067d..5c73967d6 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -562,7 +562,6 @@ ar: warning_presets: add_new: إضافة واحد جديد delete: حذف - edit: تعديل edit_preset: تعديل نموذج التحذير title: إدارة نماذج التحذير admin_mailer: diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 1c30b6b7a..22782ae16 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -573,7 +573,6 @@ ca: warning_presets: add_new: Afegeix-ne un de nou delete: Esborra - edit: Edita edit_preset: Edita l'avís predeterminat title: Gestiona les configuracions predefinides dels avisos admin_mailer: diff --git a/config/locales/co.yml b/config/locales/co.yml index 24f7f45fc..d9127a385 100644 --- a/config/locales/co.yml +++ b/config/locales/co.yml @@ -573,7 +573,6 @@ co: warning_presets: add_new: Aghjunghje delete: Sguassà - edit: Cambià edit_preset: Cambià a preselezzione d'avertimentu title: Amministrà e preselezzione d'avertimentu admin_mailer: diff --git a/config/locales/cs.yml b/config/locales/cs.yml index bab669e7e..23161ec5c 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -588,7 +588,6 @@ cs: warning_presets: add_new: Přidat nové delete: Smazat - edit: Upravit edit_preset: Upravit předlohu pro varování title: Spravovat předlohy pro varování admin_mailer: diff --git a/config/locales/cy.yml b/config/locales/cy.yml index afca0212a..a9e8a26da 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -605,7 +605,6 @@ cy: warning_presets: add_new: Ychwanegu newydd delete: Dileu - edit: Golygu edit_preset: Golygu rhagosodiad rhybudd title: Rheoli rhagosodiadau rhybudd admin_mailer: diff --git a/config/locales/da.yml b/config/locales/da.yml index 1cdf7722e..c978029b3 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -489,7 +489,6 @@ da: most_recent: Seneste warning_presets: delete: Slet - edit: Rediger admin_mailer: new_report: body: "%{reporter} har anmeldt %{target}" diff --git a/config/locales/de.yml b/config/locales/de.yml index 50f994473..6907efc60 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -573,7 +573,6 @@ de: warning_presets: add_new: Neu hinzufügen delete: Löschen - edit: Bearbeiten edit_preset: Warnungsvorlage bearbeiten title: Warnungsvorlagen verwalten admin_mailer: diff --git a/config/locales/el.yml b/config/locales/el.yml index 85c7bc648..dd9c93172 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -573,7 +573,6 @@ el: warning_presets: add_new: Πρόσθεση νέου delete: Διαγραφή - edit: Ενημέρωση edit_preset: Ενημέρωση προκαθορισμένης προειδοποίησης title: Διαχείριση προκαθορισμένων προειδοποιήσεων admin_mailer: diff --git a/config/locales/en.yml b/config/locales/en.yml index a031f9e9d..05d92b121 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -576,7 +576,6 @@ en: warning_presets: add_new: Add new delete: Delete - edit: Edit edit_preset: Edit warning preset title: Manage warning presets admin_mailer: diff --git a/config/locales/en_GB.yml b/config/locales/en_GB.yml index 0742559ed..1375ebb33 100644 --- a/config/locales/en_GB.yml +++ b/config/locales/en_GB.yml @@ -474,7 +474,6 @@ en_GB: warning_presets: add_new: Add new delete: Delete - edit: Edit edit_preset: Edit warning preset title: Manage warning presets admin_mailer: diff --git a/config/locales/eo.yml b/config/locales/eo.yml index b3cb2b523..32771b4c4 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -557,7 +557,6 @@ eo: warning_presets: add_new: Aldoni novan delete: Forigi - edit: Redakti edit_preset: Redakti avertan antaŭagordon title: Administri avertajn antaŭagordojn admin_mailer: diff --git a/config/locales/es-AR.yml b/config/locales/es-AR.yml index 6eec00cb6..67fb83de2 100644 --- a/config/locales/es-AR.yml +++ b/config/locales/es-AR.yml @@ -573,7 +573,6 @@ es-AR: warning_presets: add_new: Agregar nuevo delete: Eliminar - edit: Editar edit_preset: Editar preajuste de advertencia title: Administrar preajustes de advertencia admin_mailer: diff --git a/config/locales/es.yml b/config/locales/es.yml index a26143018..3acf29b15 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -573,7 +573,6 @@ es: warning_presets: add_new: Añadir nuevo delete: Borrar - edit: Editar edit_preset: Editar aviso predeterminado title: Editar configuración predeterminada de avisos admin_mailer: diff --git a/config/locales/et.yml b/config/locales/et.yml index 716da9010..8e3d56622 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -576,7 +576,6 @@ et: warning_presets: add_new: Lisa uus delete: Kustuta - edit: Redigeeri edit_preset: Redigeeri hoiatuse eelseadistust title: Halda hoiatuste eelseadistusi admin_mailer: diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 3ca68d321..e44fc61b0 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -573,7 +573,6 @@ eu: warning_presets: add_new: Gehitu berria delete: Ezabatu - edit: Editatu edit_preset: Editatu abisu aurre-ezarpena title: Kudeatu abisu aurre-ezarpenak admin_mailer: diff --git a/config/locales/fa.yml b/config/locales/fa.yml index 02bbd2938..aca4df69b 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -575,7 +575,6 @@ fa: warning_presets: add_new: افزودن تازه delete: زدودن - edit: ویرایش edit_preset: ویرایش هشدار پیش‌فرض title: مدیریت هشدارهای پیش‌فرض admin_mailer: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index bf79bc0ff..c1d8cc2bf 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -573,7 +573,6 @@ fr: warning_presets: add_new: Ajouter un nouveau delete: Effacer - edit: Éditer edit_preset: Éditer les avertissements prédéfinis title: Gérer les avertissements prédéfinis admin_mailer: diff --git a/config/locales/gl.yml b/config/locales/gl.yml index c3a33932d..9f0f16b5b 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -573,7 +573,6 @@ gl: warning_presets: add_new: Engadir novo delete: Eliminar - edit: Editar edit_preset: Editar aviso preestablecido title: Xestionar avisos preestablecidos admin_mailer: diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 2d7f3a137..c6b619dd2 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -575,7 +575,6 @@ hu: warning_presets: add_new: Új hozzáadása delete: Törlés - edit: Szerkesztés edit_preset: Figyelmeztetés szerkesztése title: Figyelmeztetések admin_mailer: diff --git a/config/locales/id.yml b/config/locales/id.yml index ca222946c..bfa71184f 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -565,7 +565,6 @@ id: warning_presets: add_new: Tambah baru delete: Hapus - edit: Sunting edit_preset: Sunting preset peringatan title: Kelola preset peringatan admin_mailer: diff --git a/config/locales/is.yml b/config/locales/is.yml index d6cf23966..336533d52 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -573,7 +573,6 @@ is: warning_presets: add_new: Bæta við nýju delete: Eyða - edit: Breyta edit_preset: Breyta forstilltri aðvörun title: Sýsla með forstilltar aðvaranir admin_mailer: diff --git a/config/locales/it.yml b/config/locales/it.yml index 2ccdc076c..636ae8924 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -573,7 +573,6 @@ it: warning_presets: add_new: Aggiungi nuovo delete: Cancella - edit: Modifica edit_preset: Modifica avviso predefinito title: Gestisci avvisi predefiniti admin_mailer: diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 24a159e57..c2a16fa15 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -565,7 +565,6 @@ ja: warning_presets: add_new: 追加 delete: 削除 - edit: 編集 edit_preset: プリセット警告文を編集 title: プリセット警告文を管理 admin_mailer: diff --git a/config/locales/kab.yml b/config/locales/kab.yml index 03f4d8c13..b398bebd9 100644 --- a/config/locales/kab.yml +++ b/config/locales/kab.yml @@ -330,7 +330,6 @@ kab: warning_presets: add_new: Rnu amaynut delete: Kkes - edit: Ẓreg admin_mailer: new_report: subject: Aneqqis amaynut i %{instance} (#%{id}) diff --git a/config/locales/kk.yml b/config/locales/kk.yml index 416a5fc7d..bb7a57e87 100644 --- a/config/locales/kk.yml +++ b/config/locales/kk.yml @@ -555,7 +555,6 @@ kk: warning_presets: add_new: Add nеw delete: Deletе - edit: Еdit edit_preset: Edit warning prеset title: Manage warning presеts admin_mailer: diff --git a/config/locales/ko.yml b/config/locales/ko.yml index e70fbef21..6ca0b2acc 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -567,7 +567,6 @@ ko: warning_presets: add_new: 새로 추가 delete: 삭제 - edit: 편집 edit_preset: 경고 틀 수정 title: 경고 틀 관리 admin_mailer: diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 9af094c01..5a4542ea8 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -410,7 +410,6 @@ lt: warning_presets: add_new: Pridėti naują delete: Ištrinti - edit: Keisti edit_preset: Keisti įspėjimo nustatymus title: Valdyti įspėjimo nustatymus admin_mailer: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 976072368..f688d5dbd 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -573,7 +573,6 @@ nl: warning_presets: add_new: Nieuwe toevoegen delete: Verwijderen - edit: Bewerken edit_preset: Voorinstelling van waarschuwing bewerken title: Voorinstellingen van waarschuwingen beheren admin_mailer: diff --git a/config/locales/nn.yml b/config/locales/nn.yml index fd61f2156..07b6397c6 100644 --- a/config/locales/nn.yml +++ b/config/locales/nn.yml @@ -566,7 +566,6 @@ nn: warning_presets: add_new: Legg til ny delete: Slett - edit: Rediger edit_preset: Endr åtvaringsoppsett title: Handsam åtvaringsoppsett admin_mailer: diff --git a/config/locales/no.yml b/config/locales/no.yml index 256ed99a3..4a1b859dc 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -561,7 +561,6 @@ warning_presets: add_new: Legg til ny delete: Slett - edit: Rediger admin_mailer: new_pending_account: body: Detaljer om den nye kontoen er nedenfor. Du kan godkjenne eller avvise denne søknaden. diff --git a/config/locales/oc.yml b/config/locales/oc.yml index 4a60227ab..d3f3a1007 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -558,7 +558,6 @@ oc: warning_presets: add_new: N’ajustar un nòu delete: Escafar - edit: Modificar edit_preset: Modificar lo tèxt predefinit d’avertiment title: Gerir los tèxtes predefinits admin_mailer: diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 28a486145..339e87fa8 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -541,7 +541,6 @@ pl: warning_presets: add_new: Dodaj nowy delete: Usuń - edit: Edytuj edit_preset: Edytuj szablon ostrzeżenia title: Zarządzaj szablonami ostrzeżeń admin_mailer: diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index abea40130..419ea5a73 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -573,7 +573,6 @@ pt-BR: warning_presets: add_new: Adicionar novo delete: Excluir - edit: Editar edit_preset: Editar o aviso pré-definido title: Gerenciar os avisos pré-definidos admin_mailer: diff --git a/config/locales/pt-PT.yml b/config/locales/pt-PT.yml index 477c9d3a3..9d3a503b1 100644 --- a/config/locales/pt-PT.yml +++ b/config/locales/pt-PT.yml @@ -573,7 +573,6 @@ pt-PT: warning_presets: add_new: Adicionar novo delete: Apagar - edit: Editar edit_preset: Editar o aviso predefinido title: Gerir os avisos predefinidos admin_mailer: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 6196ac3eb..f1547ddf2 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -594,7 +594,6 @@ ru: warning_presets: add_new: Добавить delete: Удалить - edit: Изменить edit_preset: Удалить шаблон предупреждения title: Управление шаблонами предупреждений admin_mailer: diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 92d51916b..f279a8e4f 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -8,6 +8,7 @@ en: acct: Specify the username@domain of the account you want to move to account_warning_preset: text: You can use toot syntax, such as URLs, hashtags and mentions + title: Optional. Not visible to the recipient admin_account_action: include_statuses: The user will see which toots have caused the moderation action or warning send_email_notification: The user will receive an explanation of what happened with their account @@ -78,6 +79,7 @@ en: acct: Handle of the new account account_warning_preset: text: Preset text + title: Title admin_account_action: include_statuses: Include reported toots in the e-mail send_email_notification: Notify the user per e-mail diff --git a/config/locales/sk.yml b/config/locales/sk.yml index dbee6bb12..2986f83d8 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -574,7 +574,6 @@ sk: warning_presets: add_new: Pridaj nové delete: Vymaž - edit: Uprav edit_preset: Uprav varovnú predlohu title: Spravuj varovné predlohy admin_mailer: diff --git a/config/locales/sl.yml b/config/locales/sl.yml index afb928f11..91720c602 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -485,7 +485,6 @@ sl: warning_presets: add_new: Dodaj novo delete: Izbriši - edit: Uredi edit_preset: Uredi prednastavitev opozoril title: Upravljaj prednastavitev opozoril admin_mailer: diff --git a/config/locales/sq.yml b/config/locales/sq.yml index 6a7a945c4..0e20902ff 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -415,7 +415,6 @@ sq: warning_presets: add_new: Shtoni të ri delete: Fshije - edit: Përpunoni edit_preset: Përpunoni sinjalizim të paracaktuar title: Administroni sinjalizime të paracaktuara admin_mailer: diff --git a/config/locales/sr.yml b/config/locales/sr.yml index c68681215..d7fb6f74d 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -431,7 +431,6 @@ sr: warning_presets: add_new: Додај нови delete: Избриши - edit: Уреди edit_preset: Уреди пресет упозорења title: Управљај пресетима упозорења admin_mailer: diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 0094ff06b..4b67ff19c 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -448,7 +448,6 @@ sv: warning_presets: add_new: Lägg till ny delete: Radera - edit: Redigera admin_mailer: new_report: body: "%{reporter} har rapporterat %{target}" diff --git a/config/locales/th.yml b/config/locales/th.yml index 7d6ec0b13..53267c805 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -488,7 +488,6 @@ th: warning_presets: add_new: เพิ่มใหม่ delete: ลบ - edit: แก้ไข edit_preset: แก้ไขคำเตือนที่ตั้งไว้ล่วงหน้า title: จัดการคำเตือนที่ตั้งไว้ล่วงหน้า admin_mailer: diff --git a/config/locales/tr.yml b/config/locales/tr.yml index cde7f1c83..1dcf9ccea 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -573,7 +573,6 @@ tr: warning_presets: add_new: Yeni ekle delete: Sil - edit: Düzenle edit_preset: Uyarı ön-ayarını düzenle title: Uyarı ön-ayarlarını yönet admin_mailer: diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 967a02717..3df83e756 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -591,7 +591,6 @@ uk: warning_presets: add_new: Додати новий delete: Видалити - edit: Редагувати edit_preset: Редагувати шаблон попередження title: Управління шаблонами попереджень admin_mailer: diff --git a/config/locales/vi.yml b/config/locales/vi.yml index ec8e853fe..cba773417 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -534,7 +534,6 @@ vi: warning_presets: add_new: Thêm mới delete: Xóa bỏ - edit: Biên tập edit_preset: Chỉnh sửa cảnh báo đặt trước title: Quản lý cài đặt trước cảnh báo admin_mailer: diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index d6618dbbe..54230fb2f 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -565,7 +565,6 @@ zh-CN: warning_presets: add_new: 添加新条目 delete: 删除 - edit: 编辑 edit_preset: 编辑预置警告 title: 管理预设警告 admin_mailer: diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index ffd5ba5e9..fd988e443 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -409,7 +409,6 @@ zh-HK: warning_presets: add_new: 新增 delete: 刪除 - edit: 編輯 admin_mailer: new_report: body: "%{reporter} 舉報了用戶 %{target}" diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 5b25688ed..984bbcf13 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -408,7 +408,6 @@ zh-TW: warning_presets: add_new: 新增 delete: 刪除 - edit: 編輯 admin_mailer: new_report: body: "%{reporter} 檢舉了使用者 %{target}" diff --git a/db/migrate/20200312144258_add_title_to_account_warning_presets.rb b/db/migrate/20200312144258_add_title_to_account_warning_presets.rb new file mode 100644 index 000000000..46a5350e7 --- /dev/null +++ b/db/migrate/20200312144258_add_title_to_account_warning_presets.rb @@ -0,0 +1,15 @@ +require Rails.root.join('lib', 'mastodon', 'migration_helpers') + +class AddTitleToAccountWarningPresets < ActiveRecord::Migration[5.2] + include Mastodon::MigrationHelpers + + disable_ddl_transaction! + + def up + safety_assured { add_column_with_default :account_warning_presets, :title, :string, default: '', allow_null: false } + end + + def down + remove_column :account_warning_presets, :title + end +end diff --git a/db/schema.rb b/db/schema.rb index a851e01fc..5d3651e52 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: 2020_03_06_035625) do +ActiveRecord::Schema.define(version: 2020_03_12_144258) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -114,6 +114,7 @@ ActiveRecord::Schema.define(version: 2020_03_06_035625) do t.text "text", default: "", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "title", default: "", null: false end create_table "account_warnings", force: :cascade do |t|