diff --git a/.haml-lint.yml b/.haml-lint.yml
index 8cfcaec8d9..b94eb8b0df 100644
--- a/.haml-lint.yml
+++ b/.haml-lint.yml
@@ -14,3 +14,5 @@ linters:
enabled: true
LineLength:
max: 320
+ ViewLength:
+ max: 200 # Override default value of 100 inherited from rubocop
diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb
index 9beb8fde6b..d3be7817ff 100644
--- a/app/controllers/admin/accounts_controller.rb
+++ b/app/controllers/admin/accounts_controller.rb
@@ -128,7 +128,7 @@ module Admin
def unblock_email
authorize @account, :unblock_email?
- CanonicalEmailBlock.where(reference_account: @account).delete_all
+ CanonicalEmailBlock.matching_account(@account).delete_all
log_action :unblock_email, @account
diff --git a/app/javascript/flavours/glitch/features/ui/components/navigation_panel.jsx b/app/javascript/flavours/glitch/features/ui/components/navigation_panel.jsx
index 7ac748e438..fa1df612fa 100644
--- a/app/javascript/flavours/glitch/features/ui/components/navigation_panel.jsx
+++ b/app/javascript/flavours/glitch/features/ui/components/navigation_panel.jsx
@@ -8,6 +8,7 @@ import { useSelector, useDispatch } from 'react-redux';
import BookmarksActiveIcon from '@/material-icons/400-24px/bookmarks-fill.svg?react';
import BookmarksIcon from '@/material-icons/400-24px/bookmarks.svg?react';
+import ExploreActiveIcon from '@/material-icons/400-24px/explore-fill.svg?react';
import ExploreIcon from '@/material-icons/400-24px/explore.svg?react';
import HomeActiveIcon from '@/material-icons/400-24px/home-fill.svg?react';
import HomeIcon from '@/material-icons/400-24px/home.svg?react';
@@ -143,7 +144,7 @@ class NavigationPanel extends Component {
)}
{trendsEnabled ? (
-
+
) : (
)}
diff --git a/app/javascript/mastodon/features/ui/components/navigation_panel.jsx b/app/javascript/mastodon/features/ui/components/navigation_panel.jsx
index f2b40af72b..14a1933436 100644
--- a/app/javascript/mastodon/features/ui/components/navigation_panel.jsx
+++ b/app/javascript/mastodon/features/ui/components/navigation_panel.jsx
@@ -11,6 +11,7 @@ import { useSelector, useDispatch } from 'react-redux';
import AlternateEmailIcon from '@/material-icons/400-24px/alternate_email.svg?react';
import BookmarksActiveIcon from '@/material-icons/400-24px/bookmarks-fill.svg?react';
import BookmarksIcon from '@/material-icons/400-24px/bookmarks.svg?react';
+import ExploreActiveIcon from '@/material-icons/400-24px/explore-fill.svg?react';
import ExploreIcon from '@/material-icons/400-24px/explore.svg?react';
import HomeActiveIcon from '@/material-icons/400-24px/home-fill.svg?react';
import HomeIcon from '@/material-icons/400-24px/home.svg?react';
@@ -145,7 +146,7 @@ class NavigationPanel extends Component {
)}
{trendsEnabled ? (
-
+
) : (
)}
diff --git a/app/models/canonical_email_block.rb b/app/models/canonical_email_block.rb
index d09df6f5e2..c05eb9801d 100644
--- a/app/models/canonical_email_block.rb
+++ b/app/models/canonical_email_block.rb
@@ -20,6 +20,7 @@ class CanonicalEmailBlock < ApplicationRecord
validates :canonical_email_hash, presence: true, uniqueness: true
scope :matching_email, ->(email) { where(canonical_email_hash: email_to_canonical_email_hash(email)) }
+ scope :matching_account, ->(account) { matching_email(account&.user_email).or(where(reference_account: account)) }
def to_log_human_identifier
canonical_email_hash
diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml
index da2f2055d0..d380d807a3 100644
--- a/app/views/admin/accounts/show.html.haml
+++ b/app/views/admin/accounts/show.html.haml
@@ -30,7 +30,7 @@
= render 'admin/accounts/counters', account: @account
- if @account.local? && @account.user.nil?
- = link_to t('admin.accounts.unblock_email'), unblock_email_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unblock_email, @account) && CanonicalEmailBlock.exists?(reference_account_id: @account.id)
+ = link_to t('admin.accounts.unblock_email'), unblock_email_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unblock_email, @account) && CanonicalEmailBlock.matching_account(@account).exists?
- else
.table-wrapper
%table.table.inline-table
diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml
index 3597152e09..8a80992785 100644
--- a/app/views/admin/dashboard/index.html.haml
+++ b/app/views/admin/dashboard/index.html.haml
@@ -16,19 +16,43 @@
.dashboard
.dashboard__item
- = react_admin_component :counter, measure: 'new_users', start_at: @time_period.first, end_at: @time_period.last, label: t('admin.dashboard.new_users'), href: admin_accounts_path(origin: 'local')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ href: admin_accounts_path(origin: 'local'),
+ label: t('admin.dashboard.new_users'),
+ measure: 'new_users',
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'active_users', start_at: @time_period.first, end_at: @time_period.last, label: t('admin.dashboard.active_users'), href: admin_accounts_path(origin: 'local')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ href: admin_accounts_path(origin: 'local'),
+ label: t('admin.dashboard.active_users'),
+ measure: 'active_users',
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'interactions', start_at: @time_period.first, end_at: @time_period.last, label: t('admin.dashboard.interactions')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ label: t('admin.dashboard.interactions'),
+ measure: 'interactions',
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'opened_reports', start_at: @time_period.first, end_at: @time_period.last, label: t('admin.dashboard.opened_reports'), href: admin_reports_path
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ href: admin_reports_path,
+ label: t('admin.dashboard.opened_reports'),
+ measure: 'opened_reports',
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'resolved_reports', start_at: @time_period.first, end_at: @time_period.last, label: t('admin.dashboard.resolved_reports'), href: admin_reports_path(resolved: '1')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ href: admin_reports_path(resolved: '1'),
+ label: t('admin.dashboard.resolved_reports'),
+ measure: 'resolved_reports',
+ start_at: @time_period.first
.dashboard__item
= link_to admin_reports_path, class: 'dashboard__quick-access' do
@@ -47,22 +71,51 @@
%span= t('admin.dashboard.pending_appeals_html', count: @pending_appeals_count)
= fa_icon 'chevron-right fw'
.dashboard__item
- = react_admin_component :dimension, dimension: 'sources', start_at: @time_period.first, end_at: @time_period.last, limit: 8, label: t('admin.dashboard.sources')
+ = react_admin_component :dimension,
+ dimension: 'sources',
+ end_at: @time_period.last,
+ label: t('admin.dashboard.sources'),
+ limit: 8,
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :dimension, dimension: 'languages', start_at: @time_period.first, end_at: @time_period.last, limit: 8, label: t('admin.dashboard.top_languages')
+ = react_admin_component :dimension,
+ dimension: 'languages',
+ end_at: @time_period.last,
+ label: t('admin.dashboard.top_languages'),
+ limit: 8,
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :dimension, dimension: 'servers', start_at: @time_period.first, end_at: @time_period.last, limit: 8, label: t('admin.dashboard.top_servers')
+ = react_admin_component :dimension,
+ dimension: 'servers',
+ end_at: @time_period.last,
+ label: t('admin.dashboard.top_servers'),
+ limit: 8,
+ start_at: @time_period.first
.dashboard__item.dashboard__item--span-double-column
- = react_admin_component :retention, start_at: @time_period.last - 6.months, end_at: @time_period.last, frequency: 'month'
+ = react_admin_component :retention,
+ end_at: @time_period.last,
+ frequency: 'month',
+ start_at: @time_period.last - 6.months
.dashboard__item.dashboard__item--span-double-row
- = react_admin_component :trends, limit: 7
+ = react_admin_component :trends,
+ limit: 7
.dashboard__item
- = react_admin_component :dimension, dimension: 'software_versions', start_at: @time_period.first, end_at: @time_period.last, limit: 4, label: t('admin.dashboard.software')
+ = react_admin_component :dimension,
+ dimension: 'software_versions',
+ end_at: @time_period.last,
+ label: t('admin.dashboard.software'),
+ limit: 4,
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :dimension, dimension: 'space_usage', start_at: @time_period.first, end_at: @time_period.last, limit: 3, label: t('admin.dashboard.space')
+ = react_admin_component :dimension,
+ dimension: 'space_usage',
+ end_at: @time_period.last,
+ label: t('admin.dashboard.space'),
+ limit: 3,
+ start_at: @time_period.first
diff --git a/app/views/admin/domain_blocks/confirm_suspension.html.haml b/app/views/admin/domain_blocks/confirm_suspension.html.haml
index a5df8ba3f3..4c4f92d710 100644
--- a/app/views/admin/domain_blocks/confirm_suspension.html.haml
+++ b/app/views/admin/domain_blocks/confirm_suspension.html.haml
@@ -14,7 +14,8 @@
%hr.spacer
- = react_admin_component :impact_report, domain: @domain_block.domain
+ = react_admin_component :impact_report,
+ domain: @domain_block.domain
.actions
= link_to t('.cancel'), admin_instances_path, class: 'button button-tertiary'
diff --git a/app/views/admin/instances/show.html.haml b/app/views/admin/instances/show.html.haml
index 5f2664df76..5bf4e899f3 100644
--- a/app/views/admin/instances/show.html.haml
+++ b/app/views/admin/instances/show.html.haml
@@ -14,21 +14,66 @@
.dashboard
.dashboard__item
- = react_admin_component :counter, measure: 'instance_accounts', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_accounts_measure'), href: admin_accounts_path(origin: 'remote', by_domain: @instance.domain)
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ href: admin_accounts_path(origin: 'remote', by_domain: @instance.domain),
+ label: t('admin.instances.dashboard.instance_accounts_measure'),
+ measure: 'instance_accounts',
+ params: { domain: @instance.domain },
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'instance_statuses', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_statuses_measure')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ label: t('admin.instances.dashboard.instance_statuses_measure'),
+ measure: 'instance_statuses',
+ params: { domain: @instance.domain },
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'instance_media_attachments', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_media_attachments_measure')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ label: t('admin.instances.dashboard.instance_media_attachments_measure'),
+ measure: 'instance_media_attachments',
+ params: { domain: @instance.domain },
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'instance_follows', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_follows_measure')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ label: t('admin.instances.dashboard.instance_follows_measure'),
+ measure: 'instance_follows',
+ params: { domain: @instance.domain },
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'instance_followers', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_followers_measure')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ label: t('admin.instances.dashboard.instance_followers_measure'),
+ measure: 'instance_followers',
+ params: { domain: @instance.domain },
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'instance_reports', start_at: @time_period.first, end_at: @time_period.last, params: { domain: @instance.domain }, label: t('admin.instances.dashboard.instance_reports_measure'), href: admin_reports_path(by_target_domain: @instance.domain)
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ href: admin_reports_path(by_target_domain: @instance.domain),
+ label: t('admin.instances.dashboard.instance_reports_measure'),
+ measure: 'instance_reports',
+ params: { domain: @instance.domain },
+ start_at: @time_period.first
.dashboard__item
- = 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')
+ = react_admin_component :dimension,
+ dimension: 'instance_accounts',
+ end_at: @time_period.last,
+ label: t('admin.instances.dashboard.instance_accounts_dimension'),
+ limit: 8,
+ params: { domain: @instance.domain },
+ start_at: @time_period.first
.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')
+ = react_admin_component :dimension,
+ dimension: 'instance_languages',
+ end_at: @time_period.last,
+ label: t('admin.instances.dashboard.instance_languages_dimension'),
+ limit: 8,
+ params: { domain: @instance.domain },
+ start_at: @time_period.first
+
- else
%p
= t('admin.instances.unknown_instance')
diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml
index e20dd38c4f..e37fa2590a 100644
--- a/app/views/admin/reports/show.html.haml
+++ b/app/views/admin/reports/show.html.haml
@@ -20,7 +20,11 @@
%p= t 'admin.reports.category_description_html'
-= react_admin_component :report_reason_selector, id: @report.id, category: @report.category, rule_ids: @report.rule_ids&.map(&:to_s), disabled: @report.action_taken?
+= react_admin_component :report_reason_selector,
+ category: @report.category,
+ disabled: @report.action_taken?,
+ id: @report.id,
+ rule_ids: @report.rule_ids&.map(&:to_s)
- if @report.comment.present?
= render 'admin/reports/comment', report: @report
diff --git a/app/views/admin/tags/show.html.haml b/app/views/admin/tags/show.html.haml
index e4c985c19e..2e4424bec6 100644
--- a/app/views/admin/tags/show.html.haml
+++ b/app/views/admin/tags/show.html.haml
@@ -9,15 +9,45 @@
.dashboard
.dashboard__item
- = react_admin_component :counter, measure: 'tag_accounts', start_at: @time_period.first, end_at: @time_period.last, params: { id: @tag.id }, label: t('admin.trends.tags.dashboard.tag_accounts_measure'), href: tag_url(@tag), target: '_blank', rel: 'noopener noreferrer'
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ href: tag_url(@tag),
+ label: t('admin.trends.tags.dashboard.tag_accounts_measure'),
+ measure: 'tag_accounts',
+ params: { id: @tag.id },
+ rel: 'noopener noreferrer',
+ start_at: @time_period.first,
+ target: '_blank'
.dashboard__item
- = react_admin_component :counter, measure: 'tag_uses', start_at: @time_period.first, end_at: @time_period.last, params: { id: @tag.id }, label: t('admin.trends.tags.dashboard.tag_uses_measure')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ label: t('admin.trends.tags.dashboard.tag_uses_measure'),
+ measure: 'tag_uses',
+ params: { id: @tag.id },
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :counter, measure: 'tag_servers', start_at: @time_period.first, end_at: @time_period.last, params: { id: @tag.id }, label: t('admin.trends.tags.dashboard.tag_servers_measure')
+ = react_admin_component :counter,
+ end_at: @time_period.last,
+ label: t('admin.trends.tags.dashboard.tag_servers_measure'),
+ measure: 'tag_servers',
+ params: { id: @tag.id },
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :dimension, dimension: 'tag_servers', start_at: @time_period.first, end_at: @time_period.last, params: { id: @tag.id }, limit: 8, label: t('admin.trends.tags.dashboard.tag_servers_dimension')
+ = react_admin_component :dimension,
+ dimension: 'tag_servers',
+ end_at: @time_period.last,
+ label: t('admin.trends.tags.dashboard.tag_servers_dimension'),
+ limit: 8,
+ params: { id: @tag.id },
+ start_at: @time_period.first
.dashboard__item
- = react_admin_component :dimension, dimension: 'tag_languages', start_at: @time_period.first, end_at: @time_period.last, params: { id: @tag.id }, limit: 8, label: t('admin.trends.tags.dashboard.tag_languages_dimension')
+ = react_admin_component :dimension,
+ dimension: 'tag_languages',
+ end_at: @time_period.last,
+ label: t('admin.trends.tags.dashboard.tag_languages_dimension'),
+ limit: 8,
+ params: { id: @tag.id },
+ start_at: @time_period.first
.dashboard__item
= link_to admin_tag_path(@tag.id), class: ['dashboard__quick-access', @tag.usable? ? 'positive' : 'negative'] do
- if @tag.usable?
diff --git a/spec/fabricators/canonical_email_block_fabricator.rb b/spec/fabricators/canonical_email_block_fabricator.rb
index 1ef53ff4a4..2f979df794 100644
--- a/spec/fabricators/canonical_email_block_fabricator.rb
+++ b/spec/fabricators/canonical_email_block_fabricator.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
Fabricator(:canonical_email_block) do
- email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
+ email { |attrs| attrs[:reference_account] ? attrs[:reference_account].user_email : sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
reference_account { Fabricate.build(:account) }
end