Skip to content

Commit

Permalink
Merge pull request mastodon#2685 from ClearlyClaire/glitch-soc/merge-…
Browse files Browse the repository at this point in the history
…upstream

Merge upstream changes up to 8a1423a
  • Loading branch information
ClearlyClaire authored Mar 20, 2024
2 parents 8cac5d8 + 4908981 commit 58a606e
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .haml-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ linters:
enabled: true
LineLength:
max: 320
ViewLength:
max: 200 # Override default value of 100 inherited from rubocop
2 changes: 1 addition & 1 deletion app/controllers/admin/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def remove_header
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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -143,7 +144,7 @@ class NavigationPanel extends Component {
)}

{trendsEnabled ? (
<ColumnLink transparent to='/explore' icon='explore' iconComponent={ExploreIcon} text={intl.formatMessage(messages.explore)} />
<ColumnLink transparent to='/explore' icon='explore' iconComponent={ExploreIcon} activeIconComponent={ExploreActiveIcon} text={intl.formatMessage(messages.explore)} />
) : (
<ColumnLink transparent to='/search' icon='search' iconComponent={SearchIcon} text={intl.formatMessage(messages.search)} />
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -145,7 +146,7 @@ class NavigationPanel extends Component {
)}

{trendsEnabled ? (
<ColumnLink transparent to='/explore' icon='explore' iconComponent={ExploreIcon} text={intl.formatMessage(messages.explore)} />
<ColumnLink transparent to='/explore' icon='explore' iconComponent={ExploreIcon} activeIconComponent={ExploreActiveIcon} text={intl.formatMessage(messages.explore)} />
) : (
<ColumnLink transparent to='/search' icon='search' iconComponent={SearchIcon} text={intl.formatMessage(messages.search)} />
)}
Expand Down
1 change: 1 addition & 0 deletions app/models/canonical_email_block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/accounts/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
77 changes: 65 additions & 12 deletions app/views/admin/dashboard/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
3 changes: 2 additions & 1 deletion app/views/admin/domain_blocks/confirm_suspension.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
61 changes: 53 additions & 8 deletions app/views/admin/instances/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 5 additions & 1 deletion app/views/admin/reports/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 35 additions & 5 deletions app/views/admin/tags/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
Loading

0 comments on commit 58a606e

Please sign in to comment.