From d1d7d14f77733be2e0938488752e94d65eedc6aa Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 18 Feb 2019 00:10:21 +0100 Subject: Fix video player width not being updated to fit container width (#10069) --- app/javascript/mastodon/features/video/index.js | 1 - 1 file changed, 1 deletion(-) (limited to 'app') diff --git a/app/javascript/mastodon/features/video/index.js b/app/javascript/mastodon/features/video/index.js index 894fe78d9..55dd249e1 100644 --- a/app/javascript/mastodon/features/video/index.js +++ b/app/javascript/mastodon/features/video/index.js @@ -347,7 +347,6 @@ class Video extends React.PureComponent { width = containerWidth; height = containerWidth / (16/9); - playerStyle.width = width; playerStyle.height = height; } -- cgit From 2f7f6af26a40fb9981c99d131cf021c71f24fb99 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 18 Feb 2019 13:37:13 +0100 Subject: Hide domain filter in admin page when “local” filter is active (#10074) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the “domain” field is ignored in this case. --- app/views/admin/accounts/index.html.haml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/admin/accounts/index.html.haml b/app/views/admin/accounts/index.html.haml index 91fddadf8..345f74f90 100644 --- a/app/views/admin/accounts/index.html.haml +++ b/app/views/admin/accounts/index.html.haml @@ -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') -- cgit From 6840a77711b2d536b9227b5a96ec565117d80205 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 18 Feb 2019 14:59:19 +0100 Subject: Add domain search/filter to the "Federation" (/admin/instances) page (#10071) --- app/controllers/admin/instances_controller.rb | 2 +- app/helpers/admin/filter_helper.rb | 2 +- app/models/domain_block.rb | 2 ++ app/models/instance_filter.rb | 8 ++++++-- app/views/admin/instances/index.html.haml | 14 ++++++++++++++ config/locales/en.yml | 1 + 6 files changed, 25 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/controllers/admin/instances_controller.rb b/app/controllers/admin/instances_controller.rb index 431ce6f4d..6dd659a30 100644 --- a/app/controllers/admin/instances_controller.rb +++ b/app/controllers/admin/instances_controller.rb @@ -38,7 +38,7 @@ module Admin end def filter_params - params.permit(:limited) + params.permit(:limited, :by_domain) end end end diff --git a/app/helpers/admin/filter_helper.rb b/app/helpers/admin/filter_helper.rb index 97beb587f..275b5f2fe 100644 --- a/app/helpers/admin/filter_helper.rb +++ b/app/helpers/admin/filter_helper.rb @@ -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 diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb index 1064ea7c8..069cda367 100644 --- a/app/models/domain_block.rb +++ b/app/models/domain_block.rb @@ -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 diff --git a/app/models/instance_filter.rb b/app/models/instance_filter.rb index 3483d8cd6..848fff53e 100644 --- a/app/models/instance_filter.rb +++ b/app/models/instance_filter.rb @@ -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 diff --git a/app/views/admin/instances/index.html.haml b/app/views/admin/instances/index.html.haml index ce35b5db4..2a5af3b5d 100644 --- a/app/views/admin/instances/index.html.haml +++ b/app/views/admin/instances/index.html.haml @@ -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_custom_emojis_path, class: 'button negative' + %hr.spacer/ - @instances.each do |instance| diff --git a/config/locales/en.yml b/config/locales/en.yml index dacf16d56..7363a7457 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -302,6 +302,7 @@ en: back_to_account: Back To Account title: "%{acct}'s Followers" instances: + by_domain: Domain delivery_available: Delivery is available known_accounts: one: "%{count} known account" -- cgit From 3a8cb6c73715919a61709bd7ce67fc5ec8d192f9 Mon Sep 17 00:00:00 2001 From: ThibG Date: Mon, 18 Feb 2019 14:59:46 +0100 Subject: Add quick link from admin account view to block/unblock instance (#10073) --- app/views/admin/accounts/show.html.haml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app') diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index 280a834ba..7ac73bd07 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -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? -- cgit From 359d26a05345895f295a91b7728fe711cd280f84 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 19 Feb 2019 14:01:22 +0100 Subject: Fix “reset” button of instance filter switching to custom emoji admin panel (#10076) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/instances/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/views/admin/instances/index.html.haml b/app/views/admin/instances/index.html.haml index 2a5af3b5d..235927140 100644 --- a/app/views/admin/instances/index.html.haml +++ b/app/views/admin/instances/index.html.haml @@ -23,7 +23,7 @@ .actions %button= t('admin.accounts.search') - = link_to t('admin.accounts.reset'), admin_custom_emojis_path, class: 'button negative' + = link_to t('admin.accounts.reset'), admin_instances_path, class: 'button negative' %hr.spacer/ -- cgit From 8e7fc7ec73c0743df378403ad2e704c9fae70400 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 19 Feb 2019 20:00:41 +0100 Subject: Fix crash when conversations have no valid participants (#10078) * Never return empty participants for conversations Fixes #10068 * Fix client-side crash when conversations have no participants --- app/javascript/mastodon/components/display_name.js | 2 +- app/javascript/mastodon/components/status.js | 2 +- app/models/account_conversation.rb | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/javascript/mastodon/components/display_name.js b/app/javascript/mastodon/components/display_name.js index 32809778a..6b9dd6f81 100644 --- a/app/javascript/mastodon/components/display_name.js +++ b/app/javascript/mastodon/components/display_name.js @@ -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; diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index 3e98d374b..6270d3c92 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -326,7 +326,7 @@ class Status extends ImmutablePureComponent { ); } - if (otherAccounts) { + if (otherAccounts && otherAccounts.size > 0) { statusAvatar = ; } else if (account === undefined || account === null) { statusAvatar = ; diff --git a/app/models/account_conversation.rb b/app/models/account_conversation.rb index cc6b39279..0c03747e2 100644 --- a/app/models/account_conversation.rb +++ b/app/models/account_conversation.rb @@ -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 -- cgit