Merge branch 'master' into glitch-soc/merge-upstream
This commit is contained in:
@@ -38,7 +38,7 @@ module Admin
|
||||
end
|
||||
|
||||
def filter_params
|
||||
params.permit(:limited)
|
||||
params.permit(:limited, :by_domain)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -6,7 +6,7 @@ module Admin::FilterHelper
|
||||
INVITE_FILTER = %i(available expired).freeze
|
||||
CUSTOM_EMOJI_FILTERS = %i(local remote by_domain shortcode).freeze
|
||||
TAGS_FILTERS = %i(hidden).freeze
|
||||
INSTANCES_FILTERS = %i(limited).freeze
|
||||
INSTANCES_FILTERS = %i(limited by_domain).freeze
|
||||
|
||||
FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS + INVITE_FILTER + CUSTOM_EMOJI_FILTERS + TAGS_FILTERS + INSTANCES_FILTERS
|
||||
|
||||
|
@@ -22,7 +22,7 @@ export default class DisplayName extends React.PureComponent {
|
||||
suffix = `+${others.size - 2}`;
|
||||
}
|
||||
} else {
|
||||
if (others) {
|
||||
if (others && others.size > 0) {
|
||||
account = others.first();
|
||||
} else {
|
||||
account = this.props.account;
|
||||
|
@@ -326,7 +326,7 @@ class Status extends ImmutablePureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
if (otherAccounts) {
|
||||
if (otherAccounts && otherAccounts.size > 0) {
|
||||
statusAvatar = <AvatarComposite accounts={otherAccounts} size={48} />;
|
||||
} else if (account === undefined || account === null) {
|
||||
statusAvatar = <Avatar account={status.get('account')} size={48} />;
|
||||
|
@@ -347,7 +347,6 @@ class Video extends React.PureComponent {
|
||||
width = containerWidth;
|
||||
height = containerWidth / (16/9);
|
||||
|
||||
playerStyle.width = width;
|
||||
playerStyle.height = height;
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,8 @@ class AccountConversation < ApplicationRecord
|
||||
if participant_account_ids.empty?
|
||||
[account]
|
||||
else
|
||||
Account.where(id: participant_account_ids)
|
||||
participants = Account.where(id: participant_account_ids)
|
||||
participants.empty? ? [account] : participants
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -24,6 +24,8 @@ class DomainBlock < ApplicationRecord
|
||||
has_many :accounts, foreign_key: :domain, primary_key: :domain
|
||||
delegate :count, to: :accounts, prefix: true
|
||||
|
||||
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
|
||||
|
||||
def self.blocked?(domain)
|
||||
where(domain: domain, severity: :suspend).exists?
|
||||
end
|
||||
|
@@ -9,9 +9,13 @@ class InstanceFilter
|
||||
|
||||
def results
|
||||
if params[:limited].present?
|
||||
DomainBlock.order(id: :desc)
|
||||
scope = DomainBlock
|
||||
scope = scope.matches_domain(params[:by_domain]) if params[:by_domain].present?
|
||||
scope.order(id: :desc)
|
||||
else
|
||||
Account.remote.by_domain_accounts
|
||||
scope = Account.remote
|
||||
scope = scope.matches_domain(params[:by_domain]) if params[:by_domain].present?
|
||||
scope.by_domain_accounts
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -26,8 +26,9 @@
|
||||
= hidden_field_tag key, params[key]
|
||||
|
||||
- %i(username by_domain display_name email ip).each do |key|
|
||||
.input.string.optional
|
||||
= text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.accounts.#{key}")
|
||||
- unless key == :by_domain && params[:remote].blank?
|
||||
.input.string.optional
|
||||
= text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.accounts.#{key}")
|
||||
|
||||
.actions
|
||||
%button= t('admin.accounts.search')
|
||||
|
@@ -166,6 +166,12 @@
|
||||
- else
|
||||
= link_to t('admin.accounts.perform_full_suspension'), new_admin_account_action_path(@account.id, type: 'suspend'), class: 'button button--destructive' if can?(:suspend, @account)
|
||||
|
||||
- unless @account.local?
|
||||
- if DomainBlock.where(domain: @account.domain).exists?
|
||||
= link_to t('admin.domain_blocks.undo'), admin_instance_path(@account.domain), class: 'button'
|
||||
- else
|
||||
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: @account.domain), class: 'button button--destructive'
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
- unless @warnings.empty?
|
||||
|
@@ -11,6 +11,20 @@
|
||||
%div{ style: 'flex: 1 1 auto; text-align: right' }
|
||||
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button'
|
||||
|
||||
= form_tag admin_instances_url, method: 'GET', class: 'simple_form' do
|
||||
.fields-group
|
||||
- Admin::FilterHelper::INSTANCES_FILTERS.each do |key|
|
||||
- if params[key].present?
|
||||
= hidden_field_tag key, params[key]
|
||||
|
||||
- %i(by_domain).each do |key|
|
||||
.input.string.optional
|
||||
= text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.instances.#{key}")
|
||||
|
||||
.actions
|
||||
%button= t('admin.accounts.search')
|
||||
= link_to t('admin.accounts.reset'), admin_instances_path, class: 'button negative'
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
- @instances.each do |instance|
|
||||
|
Reference in New Issue
Block a user