diff options
-rw-r--r-- | app/models/instance.rb | 8 | ||||
-rw-r--r-- | app/views/admin/instances/index.html.haml | 21 |
2 files changed, 13 insertions, 16 deletions
diff --git a/app/models/instance.rb b/app/models/instance.rb index a01db1212..797a191e0 100644 --- a/app/models/instance.rb +++ b/app/models/instance.rb @@ -11,12 +11,8 @@ class Instance @domain_block = resource.is_a?(DomainBlock) ? resource : DomainBlock.rule_for(domain) end - def cached_sample_accounts - Rails.cache.fetch("#{cache_key}/sample_accounts", expires_in: 12.hours) { Account.where(domain: domain).searchable.joins(:account_stat).popular.limit(3) } - end - - def cached_accounts_count - @accounts_count || Rails.cache.fetch("#{cache_key}/count", expires_in: 12.hours) { Account.where(domain: domain).count } + def countable? + @accounts_count.present? end def to_param diff --git a/app/views/admin/instances/index.html.haml b/app/views/admin/instances/index.html.haml index 9574c3147..61e578409 100644 --- a/app/views/admin/instances/index.html.haml +++ b/app/views/admin/instances/index.html.haml @@ -33,21 +33,22 @@ %h4 = instance.domain %small - = t('admin.instances.known_accounts', count: instance.cached_accounts_count) - - if instance.domain_block + - first_item = true - if !instance.domain_block.noop? - • = t("admin.domain_blocks.severity.#{instance.domain_block.severity}") + - first_item = false - if instance.domain_block.reject_media? - • + - unless first_item + • = t('admin.domain_blocks.rejecting_media') + - first_item = false - if instance.domain_block.reject_reports? - • + - unless first_item + • = t('admin.domain_blocks.rejecting_reports') - - .avatar-stack - - instance.cached_sample_accounts.each do |account| - = image_tag current_account&.user&.setting_auto_play_gif ? account.avatar_original_url : account.avatar_static_url, width: 48, height: 48, alt: '', class: 'account__avatar' - + - else + = t('admin.accounts.no_limits_imposed') + - if instance.countable? + .trends__item__current{ title: t('admin.instances.known_accounts', count: instance.accounts_count) }= number_to_human instance.accounts_count, strip_insignificant_zeros: true = paginate paginated_instances |