Merge branch 'master' into glitch-soc/merge-upstream

Conflicts:
- app/models/media_attachment.rb
  Upstream added audio attachment support
- app/serializers/initial_state_serializer.rb
  Upstream added audio attachment support and how mimetypes are returned
- app/serializers/rest/instance_serializer.rb
  Upstream added a few fields
- config/application.rb
  Upstream added a different paperclip transcoder
This commit is contained in:
Thibaut Girka
2019-06-24 14:47:48 +02:00
87 changed files with 1585 additions and 397 deletions

View File

@@ -205,7 +205,7 @@ class ActivityPub::ProcessAccountService < BaseService
def domain_block
return @domain_block if defined?(@domain_block)
@domain_block = DomainBlock.find_by(domain: @domain)
@domain_block = DomainBlock.rule_for(@domain)
end
def key_changed?

View File

@@ -76,7 +76,7 @@ class BlockDomainService < BaseService
end
def blocked_domain_accounts
Account.where(domain: blocked_domain)
Account.by_domain_and_subdomains(blocked_domain)
end
def media_from_blocked_domain
@@ -84,6 +84,6 @@ class BlockDomainService < BaseService
end
def emojis_from_blocked_domains
CustomEmoji.where(domain: blocked_domain)
CustomEmoji.by_domain_and_subdomains(blocked_domain)
end
end

View File

@@ -107,7 +107,7 @@ class PostStatusService < BaseService
@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i))
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if @media.size > 1 && @media.find(&:video?)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if @media.size > 1 && @media.find(&:audio_or_video?)
end
def language_from_option(str)

View File

@@ -146,7 +146,7 @@ class ResolveAccountService < BaseService
def domain_block
return @domain_block if defined?(@domain_block)
@domain_block = DomainBlock.find_by(domain: @domain)
@domain_block = DomainBlock.rule_for(@domain)
end
def atom_url

View File

@@ -14,7 +14,8 @@ class UnblockDomainService < BaseService
end
def blocked_accounts
scope = Account.where(domain: domain_block.domain)
scope = Account.by_domain_and_subdomains(domain_block.domain)
if domain_block.silence?
scope.where(silenced_at: @domain_block.created_at)
else

View File

@@ -26,7 +26,7 @@ class UpdateRemoteProfileService < BaseService
account.note = remote_profile.note || ''
account.locked = remote_profile.locked?
if !account.suspended? && !DomainBlock.find_by(domain: account.domain)&.reject_media?
if !account.suspended? && !DomainBlock.reject_media?(account.domain)
if remote_profile.avatar.present?
account.avatar_remote_url = remote_profile.avatar
else
@@ -46,7 +46,7 @@ class UpdateRemoteProfileService < BaseService
end
def save_emojis
do_not_download = DomainBlock.find_by(domain: account.domain)&.reject_media?
do_not_download = DomainBlock.reject_media?(account.domain)
return if do_not_download