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

Conflicts:
	Gemfile

Solved conflicts by using upstream's line for posix-spawn
This commit is contained in:
Thibaut Girka
2018-05-16 21:52:38 +02:00
62 changed files with 672 additions and 437 deletions

View File

@ -23,6 +23,8 @@ class ActivityPub::ProcessAccountService < BaseService
create_account if @account.nil?
update_account
process_tags
else
raise Mastodon::RaceConditionError
end
end
@ -44,7 +46,6 @@ class ActivityPub::ProcessAccountService < BaseService
@account.protocol = :activitypub
@account.username = @username
@account.domain = @domain
@account.uri = @uri
@account.suspended = true if auto_suspend?
@account.silenced = true if auto_silence?
@account.private_key = nil
@ -67,6 +68,7 @@ class ActivityPub::ProcessAccountService < BaseService
@account.followers_url = @json['followers'] || ''
@account.featured_collection_url = @json['featured'] || ''
@account.url = url || @uri
@account.uri = @uri
@account.display_name = @json['name'] || ''
@account.note = @json['summary'] || ''
@account.locked = @json['manuallyApprovesFollowers'] || false

View File

@ -23,6 +23,8 @@ class FetchLinkCardService < BaseService
if lock.acquired?
@card = PreviewCard.find_by(url: @url)
process_url if @card.nil? || @card.updated_at <= 2.weeks.ago
else
raise Mastodon::RaceConditionError
end
end

View File

@ -49,6 +49,8 @@ class ResolveAccountService < BaseService
else
handle_ostatus
end
else
raise Mastodon::RaceConditionError
end
end

View File

@ -41,24 +41,24 @@ class UpdateRemoteProfileService < BaseService
account.header.destroy
end
save_emojis(account) if remote_profile.emojis.present?
save_emojis if remote_profile.emojis.present?
end
end
def save_emojis(parent)
do_not_download = DomainBlock.find_by(domain: parent.account.domain)&.reject_media?
def save_emojis
do_not_download = DomainBlock.find_by(domain: account.domain)&.reject_media?
return if do_not_download
remote_account.emojis.each do |link|
remote_profile.emojis.each do |link|
next unless link['href'] && link['name']
shortcode = link['name'].delete(':')
emoji = CustomEmoji.find_by(shortcode: shortcode, domain: parent.account.domain)
emoji = CustomEmoji.find_by(shortcode: shortcode, domain: account.domain)
next unless emoji.nil?
emoji = CustomEmoji.new(shortcode: shortcode, domain: parent.account.domain)
emoji = CustomEmoji.new(shortcode: shortcode, domain: account.domain)
emoji.image_remote_url = link['href']
emoji.save
end