Add support for displaying unknown servers on /admin/instances/:domain (#27150)

This commit is contained in:
Claire 2023-10-23 14:27:57 +02:00 committed by GitHub
parent c3e0eb3699
commit 99f2534cee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 46 deletions

View file

@ -49,7 +49,7 @@ module Admin
private
def set_instance
@instance = Instance.find(TagManager.instance.normalize_domain(params[:id]&.strip))
@instance = Instance.find_or_initialize_by(domain: TagManager.instance.normalize_domain(params[:id]&.strip))
end
def set_instances

View file

@ -7,6 +7,7 @@
= ' - '
= l(@time_period.last)
- if @instance.persisted?
%p
= fa_icon 'info fw'
= t('admin.instances.totals_time_period_hint_html')
@ -28,6 +29,9 @@
= react_admin_component :dimension, dimension: 'instance_accounts', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, limit: 8, label: t('admin.instances.dashboard.instance_accounts_dimension')
.dashboard__item
= react_admin_component :dimension, dimension: 'instance_languages', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, limit: 8, label: t('admin.instances.dashboard.instance_languages_dimension')
- else
%p
= t('admin.instances.unknown_instance')
%hr.spacer/
@ -62,6 +66,7 @@
- else
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @instance.domain), class: 'button'
- if @instance.persisted?
%hr.spacer/
%h3= t('admin.instances.availability.title')

View file

@ -534,6 +534,7 @@ en:
total_reported: Reports about them
total_storage: Media attachments
totals_time_period_hint_html: The totals displayed below include data for all time.
unknown_instance: There is currently no record of this domain on this server.
invites:
deactivate_all: Deactivate all
filter: