From de4681b2be0b0efa1dede092445a53d4a593c140 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 31 May 2017 14:39:35 -0400 Subject: [PATCH] Move admin/pubsubhubbub controller to admin/subscriptions (#3442) --- .../admin/pubsubhubbub_controller.rb | 9 --------- .../admin/subscriptions_controller.rb | 19 +++++++++++++++++++ app/views/admin/pubsubhubbub/index.html.haml | 15 --------------- .../_subscription.html.haml | 0 app/views/admin/subscriptions/index.html.haml | 15 +++++++++++++++ config/locales/ca.yml | 2 +- config/locales/de.yml | 2 +- config/locales/en.yml | 2 +- config/locales/fa.yml | 2 +- config/locales/fr.yml | 2 +- config/locales/he.yml | 2 +- config/locales/id.yml | 2 +- config/locales/io.yml | 2 +- config/locales/ja.yml | 2 +- config/locales/no.yml | 2 +- config/locales/oc.yml | 2 +- config/locales/pl.yml | 2 +- config/locales/pt-BR.yml | 2 +- config/locales/pt.yml | 2 +- config/locales/ru.yml | 2 +- config/locales/th.yml | 2 +- config/locales/tr.yml | 2 +- config/locales/uk.yml | 2 +- config/locales/zh-CN.yml | 2 +- config/locales/zh-HK.yml | 2 +- config/locales/zh-TW.yml | 2 +- config/navigation.rb | 2 +- config/routes.rb | 2 +- ...ec.rb => subscriptions_controller_spec.rb} | 2 +- 29 files changed, 58 insertions(+), 48 deletions(-) delete mode 100644 app/controllers/admin/pubsubhubbub_controller.rb create mode 100644 app/controllers/admin/subscriptions_controller.rb delete mode 100644 app/views/admin/pubsubhubbub/index.html.haml rename app/views/admin/{pubsubhubbub => subscriptions}/_subscription.html.haml (100%) create mode 100644 app/views/admin/subscriptions/index.html.haml rename spec/controllers/admin/{pubsubhubbub_controller_spec.rb => subscriptions_controller_spec.rb} (91%) diff --git a/app/controllers/admin/pubsubhubbub_controller.rb b/app/controllers/admin/pubsubhubbub_controller.rb deleted file mode 100644 index 2677a59e46..0000000000 --- a/app/controllers/admin/pubsubhubbub_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -module Admin - class PubsubhubbubController < BaseController - def index - @subscriptions = Subscription.order(id: :desc).includes(:account).page(params[:page]) - end - end -end diff --git a/app/controllers/admin/subscriptions_controller.rb b/app/controllers/admin/subscriptions_controller.rb new file mode 100644 index 0000000000..624a475a3d --- /dev/null +++ b/app/controllers/admin/subscriptions_controller.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Admin + class SubscriptionsController < BaseController + def index + @subscriptions = ordered_subscriptions.page(requested_page) + end + + private + + def ordered_subscriptions + Subscription.order(id: :desc).includes(:account) + end + + def requested_page + params[:page].to_i + end + end +end diff --git a/app/views/admin/pubsubhubbub/index.html.haml b/app/views/admin/pubsubhubbub/index.html.haml deleted file mode 100644 index 066d9e5c68..0000000000 --- a/app/views/admin/pubsubhubbub/index.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- content_for :page_title do - = t('admin.pubsubhubbub.title') - -%table.table - %thead - %tr - %th= t('admin.pubsubhubbub.topic') - %th= t('admin.pubsubhubbub.callback_url') - %th= t('admin.pubsubhubbub.confirmed') - %th= t('admin.pubsubhubbub.expires_in') - %th= t('admin.pubsubhubbub.last_delivery') - %tbody - = render partial: 'subscription', collection: @subscriptions - -= paginate @subscriptions diff --git a/app/views/admin/pubsubhubbub/_subscription.html.haml b/app/views/admin/subscriptions/_subscription.html.haml similarity index 100% rename from app/views/admin/pubsubhubbub/_subscription.html.haml rename to app/views/admin/subscriptions/_subscription.html.haml diff --git a/app/views/admin/subscriptions/index.html.haml b/app/views/admin/subscriptions/index.html.haml new file mode 100644 index 0000000000..21b3238a6b --- /dev/null +++ b/app/views/admin/subscriptions/index.html.haml @@ -0,0 +1,15 @@ +- content_for :page_title do + = t('admin.subscriptions.title') + +%table.table + %thead + %tr + %th= t('admin.subscriptions.topic') + %th= t('admin.subscriptions.callback_url') + %th= t('admin.subscriptions.confirmed') + %th= t('admin.subscriptions.expires_in') + %th= t('admin.subscriptions.last_delivery') + %tbody + = render @subscriptions + += paginate @subscriptions diff --git a/config/locales/ca.yml b/config/locales/ca.yml index e3b3a91f93..1917441d70 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -134,7 +134,7 @@ ca: account_count: Comptes coneguts domain_name: Domini title: Instàncies conegudes - pubsubhubbub: + subscriptions: callback_url: Callback URL confirmed: Confirmat expires_in: Expira en diff --git a/config/locales/de.yml b/config/locales/de.yml index a7d86e2849..0a11e04225 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -119,7 +119,7 @@ de: account_count: Bekannte Konten domain_name: Domain title: Bekannte Instanzen - pubsubhubbub: + subscriptions: callback_url: Callback-URL confirmed: Bestätigt expires_in: Verfällt in diff --git a/config/locales/en.yml b/config/locales/en.yml index c27dfb0e50..2ff2f7eec6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -134,7 +134,7 @@ en: account_count: Known accounts domain_name: Domain title: Known Instances - pubsubhubbub: + subscriptions: callback_url: Callback URL confirmed: Confirmed expires_in: Expires in diff --git a/config/locales/fa.yml b/config/locales/fa.yml index 458d03db54..de59e4f3fe 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -130,7 +130,7 @@ fa: account_count: حساب‌های شناخته‌شده domain_name: دامین title: سرورهای شناخته‌شده - pubsubhubbub: + subscriptions: callback_url: نشانی Callback confirmed: تأییدشده expires_in: مهلت انقضا diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 4d9af2bc33..8cd8fdd080 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -110,7 +110,7 @@ fr: undo: Annuler title: Blocage de domaines undo: Annuler - pubsubhubbub: + subscriptions: callback_url: URL de rappel confirmed: Confirmé expires_in: Expire dans diff --git a/config/locales/he.yml b/config/locales/he.yml index 88b082b30e..f38981f683 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -134,7 +134,7 @@ he: account_count: חשבונות מוכרים domain_name: שם מתחם title: שרתים מוכרים - pubsubhubbub: + subscriptions: callback_url: קישורית Callback confirmed: מאושר expires_in: פג תוקף ב- diff --git a/config/locales/id.yml b/config/locales/id.yml index f174cdacba..48fe466e55 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -129,7 +129,7 @@ id: account_count: Akun yang diketahui domain_name: Domain title: Server yang diketahui - pubsubhubbub: + subscriptions: callback_url: Callback URL confirmed: Dikonfirmasi expires_in: Kadaluarsa dalam diff --git a/config/locales/io.yml b/config/locales/io.yml index 240de6422b..42351502b9 100644 --- a/config/locales/io.yml +++ b/config/locales/io.yml @@ -118,7 +118,7 @@ io: account_count: Known accounts domain_name: Domain title: Known Instances - pubsubhubbub: + subscriptions: callback_url: Callback URL confirmed: Confirmed expires_in: Expires in diff --git a/config/locales/ja.yml b/config/locales/ja.yml index cc5430c473..e8bf9e61a5 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -134,7 +134,7 @@ ja: account_count: 既知のアカウント数 domain_name: ドメイン名 title: 既知のインスタンス - pubsubhubbub: + subscriptions: callback_url: コールバックURL confirmed: 確認済み expires_in: 期限 diff --git a/config/locales/no.yml b/config/locales/no.yml index 0ed9aea5e3..295293b09b 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -131,7 +131,7 @@ account_count: Kjente kontoer domain_name: Domene title: Kjente instanser - pubsubhubbub: + subscriptions: callback_url: Callback-URL confirmed: Bekreftet expires_in: Utløper om diff --git a/config/locales/oc.yml b/config/locales/oc.yml index 7f6e3daf0f..2a2680a907 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -134,7 +134,7 @@ oc: account_count: Comptes coneguts domain_name: Domeni title: Instàncias conegudas - pubsubhubbub: + subscriptions: callback_url: URL de rapèl confirmed: Confirmat expires_in: S’acaba dins diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 247e6c4ff6..e3b4c64e93 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -134,7 +134,7 @@ pl: account_count: Znane konta domain_name: Domena title: Znane instancje - pubsubhubbub: + subscriptions: callback_url: URL zwrotny confirmed: Potwierdzono expires_in: Wygasa diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 5eab5d6938..1ec10f8d0b 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -130,7 +130,7 @@ pt-BR: account_count: Contas conhecidas domain_name: Domínio title: Instâncias conhecidas - pubsubhubbub: + subscriptions: callback_url: URL de Callback confirmed: Confirmado expires_in: Expira em diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 43659c91e5..f628e59f2b 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -126,7 +126,7 @@ pt: account_count: Contas conhecidas domain_name: Domínio title: Instâncias conhecidas - pubsubhubbub: + subscriptions: callback_url: URL de Callback confirmed: Confirmado expires_in: Expira em diff --git a/config/locales/ru.yml b/config/locales/ru.yml index d26b235ed2..f7a022f114 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -113,7 +113,7 @@ ru: undo: Отменить title: Доменные блокировки undo: Отемнить - pubsubhubbub: + subscriptions: callback_url: Callback URL confirmed: Подтверждено expires_in: Истекает через diff --git a/config/locales/th.yml b/config/locales/th.yml index dd330cc2b6..ab98adf737 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -131,7 +131,7 @@ th: account_count: Known accounts domain_name: ชื่อโดเมน title: Known Instances - pubsubhubbub: + subscriptions: callback_url: Callback URL confirmed: ยืนยัน expires_in: หมดอายุภายใน diff --git a/config/locales/tr.yml b/config/locales/tr.yml index b225883c75..ea525e0c05 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -130,7 +130,7 @@ tr: account_count: Bilinen hesaplar domain_name: Domain title: Bilinen Sunucular - pubsubhubbub: + subscriptions: callback_url: Callback linki confirmed: Onaylandı expires_in: Bitiş Tarihi diff --git a/config/locales/uk.yml b/config/locales/uk.yml index a06609ff05..227356f86f 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -113,7 +113,7 @@ uk: undo: Відмінити title: Доменні блокування undo: Відмінити - pubsubhubbub: + subscriptions: callback_url: Callback URL confirmed: Підтверджено expires_in: Спливає через diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index edfc381db0..2dc6f813f1 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -134,7 +134,7 @@ zh-CN: account_count: 已知帐号 domain_name: 域名 title: 已知实例 - pubsubhubbub: + subscriptions: callback_url: 回调 URL confirmed: 确定 expires_in: 期限 diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index e6223917ea..b886af8de6 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -130,7 +130,7 @@ zh-HK: account_count: 已知帳號 domain_name: 域名 title: 已知服務站 - pubsubhubbub: + subscriptions: callback_url: 回傳 URL confirmed: 確定 expires_in: 期限 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 82b07be34f..cb96f65439 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -92,7 +92,7 @@ zh-TW: title: 新封鎖網域 severity: 嚴重度 title: 網域封鎖 - pubsubhubbub: + subscriptions: callback_url: Callback URL confirmed: 已確認 expires_in: 期限 diff --git a/config/navigation.rb b/config/navigation.rb index 38dee91b24..85ed62118a 100644 --- a/config/navigation.rb +++ b/config/navigation.rb @@ -19,7 +19,7 @@ SimpleNavigation::Configuration.run do |navigation| admin.item :reports, safe_join([fa_icon('flag fw'), t('admin.reports.title')]), admin_reports_url, highlights_on: %r{/admin/reports} admin.item :accounts, safe_join([fa_icon('users fw'), t('admin.accounts.title')]), admin_accounts_url, highlights_on: %r{/admin/accounts} admin.item :instances, safe_join([fa_icon('cloud fw'), t('admin.instances.title')]), admin_instances_url, highlights_on: %r{/admin/instances} - admin.item :pubsubhubbubs, safe_join([fa_icon('paper-plane-o fw'), t('admin.pubsubhubbub.title')]), admin_pubsubhubbub_index_url + admin.item :subscriptions, safe_join([fa_icon('paper-plane-o fw'), t('admin.subscriptions.title')]), admin_subscriptions_url admin.item :domain_blocks, safe_join([fa_icon('lock fw'), t('admin.domain_blocks.title')]), admin_domain_blocks_url, highlights_on: %r{/admin/domain_blocks} admin.item :sidekiq, safe_join([fa_icon('diamond fw'), 'Sidekiq']), sidekiq_url, link_html: { target: 'sidekiq' } admin.item :pghero, safe_join([fa_icon('database fw'), 'PgHero']), pghero_url, link_html: { target: 'pghero' } diff --git a/config/routes.rb b/config/routes.rb index 7db3c74b13..b1590f9291 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -74,7 +74,7 @@ Rails.application.routes.draw do resource :authorize_follow, only: [:show, :create] namespace :admin do - resources :pubsubhubbub, only: [:index] + resources :subscriptions, only: [:index] resources :domain_blocks, only: [:index, :new, :create, :show, :destroy] resource :settings, only: [:edit, :update] resources :instances, only: [:index] diff --git a/spec/controllers/admin/pubsubhubbub_controller_spec.rb b/spec/controllers/admin/subscriptions_controller_spec.rb similarity index 91% rename from spec/controllers/admin/pubsubhubbub_controller_spec.rb rename to spec/controllers/admin/subscriptions_controller_spec.rb index c8e8e7a842..eb6f12b16e 100644 --- a/spec/controllers/admin/pubsubhubbub_controller_spec.rb +++ b/spec/controllers/admin/subscriptions_controller_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'rails_helper' -RSpec.describe Admin::PubsubhubbubController, type: :controller do +RSpec.describe Admin::SubscriptionsController, type: :controller do render_views describe 'GET #index' do