Move admin/pubsubhubbub controller to admin/subscriptions (#3442)
This commit is contained in:
		
				
					committed by
					
						 Eugen Rochko
						Eugen Rochko
					
				
			
			
				
	
			
			
			
						parent
						
							a132332b86
						
					
				
				
					commit
					de4681b2be
				
			| @@ -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 | ||||
							
								
								
									
										19
									
								
								app/controllers/admin/subscriptions_controller.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								app/controllers/admin/subscriptions_controller.rb
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||
| @@ -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 | ||||
							
								
								
									
										15
									
								
								app/views/admin/subscriptions/index.html.haml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								app/views/admin/subscriptions/index.html.haml
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -130,7 +130,7 @@ fa: | ||||
|       account_count: حسابهای شناختهشده | ||||
|       domain_name: دامین | ||||
|       title: سرورهای شناختهشده | ||||
|     pubsubhubbub: | ||||
|     subscriptions: | ||||
|       callback_url: نشانی Callback | ||||
|       confirmed: تأییدشده | ||||
|       expires_in: مهلت انقضا | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -134,7 +134,7 @@ he: | ||||
|       account_count: חשבונות מוכרים | ||||
|       domain_name: שם מתחם | ||||
|       title: שרתים מוכרים | ||||
|     pubsubhubbub: | ||||
|     subscriptions: | ||||
|       callback_url: קישורית Callback | ||||
|       confirmed: מאושר | ||||
|       expires_in: פג תוקף ב- | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -134,7 +134,7 @@ ja: | ||||
|       account_count: 既知のアカウント数 | ||||
|       domain_name: ドメイン名 | ||||
|       title: 既知のインスタンス | ||||
|     pubsubhubbub: | ||||
|     subscriptions: | ||||
|       callback_url: コールバックURL | ||||
|       confirmed: 確認済み | ||||
|       expires_in: 期限 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -113,7 +113,7 @@ ru: | ||||
|         undo: Отменить | ||||
|       title: Доменные блокировки | ||||
|       undo: Отемнить | ||||
|     pubsubhubbub: | ||||
|     subscriptions: | ||||
|       callback_url: Callback URL | ||||
|       confirmed: Подтверждено | ||||
|       expires_in: Истекает через | ||||
|   | ||||
| @@ -131,7 +131,7 @@ th: | ||||
|       account_count: Known accounts | ||||
|       domain_name: ชื่อโดเมน | ||||
|       title: Known Instances | ||||
|     pubsubhubbub: | ||||
|     subscriptions: | ||||
|       callback_url: Callback URL | ||||
|       confirmed: ยืนยัน | ||||
|       expires_in: หมดอายุภายใน | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -113,7 +113,7 @@ uk: | ||||
|         undo: Відмінити | ||||
|       title: Доменні блокування | ||||
|       undo: Відмінити | ||||
|     pubsubhubbub: | ||||
|     subscriptions: | ||||
|       callback_url: Callback URL | ||||
|       confirmed: Підтверджено | ||||
|       expires_in: Спливає через | ||||
|   | ||||
| @@ -134,7 +134,7 @@ zh-CN: | ||||
|       account_count: 已知帐号 | ||||
|       domain_name: 域名 | ||||
|       title: 已知实例 | ||||
|     pubsubhubbub: | ||||
|     subscriptions: | ||||
|       callback_url: 回调 URL | ||||
|       confirmed: 确定 | ||||
|       expires_in: 期限 | ||||
|   | ||||
| @@ -130,7 +130,7 @@ zh-HK: | ||||
|       account_count: 已知帳號 | ||||
|       domain_name: 域名 | ||||
|       title: 已知服務站 | ||||
|     pubsubhubbub: | ||||
|     subscriptions: | ||||
|       callback_url: 回傳 URL | ||||
|       confirmed: 確定 | ||||
|       expires_in: 期限 | ||||
|   | ||||
| @@ -92,7 +92,7 @@ zh-TW: | ||||
|         title: 新封鎖網域 | ||||
|       severity: 嚴重度 | ||||
|       title: 網域封鎖 | ||||
|     pubsubhubbub: | ||||
|     subscriptions: | ||||
|       callback_url: Callback URL | ||||
|       confirmed: 已確認 | ||||
|       expires_in: 期限 | ||||
|   | ||||
| @@ -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' } | ||||
|   | ||||
| @@ -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] | ||||
|   | ||||
| @@ -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 | ||||
		Reference in New Issue
	
	Block a user