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

Conflicts:
- `config/routes.rb`:
  Upstream disabled E2EE routes, which we did earlier, but slightly
  differently. Took upstream's version.
This commit is contained in:
Thibaut Girka
2020-07-15 15:32:40 +02:00
156 changed files with 2855 additions and 1070 deletions

View File

@ -185,7 +185,7 @@ class ActivityPub::Activity
end
def followed_by_local_accounts?
@account.passive_relationships.exists?
@account.passive_relationships.exists? || @options[:relayed_through_account]&.passive_relationships&.exists?
end
def requested_through_relay?

View File

@ -45,7 +45,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
RedisLock.acquire(lock_options) do |lock|
if lock.acquired?
return if delete_arrived_first?(object_uri) || poll_vote?
return if delete_arrived_first?(object_uri) || poll_vote? # rubocop:disable Lint/NonLocalExitFromIterator
@status = find_existing_status

View File

@ -72,16 +72,16 @@ class ActivityPub::TagManager
account_ids = status.active_mentions.pluck(:account_id)
to = status.account.followers.where(id: account_ids).each_with_object([]) do |account, result|
result << uri_for(account)
result << account.followers_url if account.group?
result << account_followers_url(account) if account.group?
end
to.concat(FollowRequest.where(target_account_id: status.account_id, account_id: account_ids).each_with_object([]) do |request, result|
result << uri_for(request.account)
result << request.account.followers_url if request.account.group?
result << account_followers_url(request.account) if request.account.group?
end)
else
status.active_mentions.each_with_object([]) do |mention, result|
result << uri_for(mention.account)
result << mention.account.followers_url if mention.account.group?
result << account_followers_url(mention.account) if mention.account.group?
end
end
end
@ -110,16 +110,16 @@ class ActivityPub::TagManager
account_ids = status.active_mentions.pluck(:account_id)
cc.concat(status.account.followers.where(id: account_ids).each_with_object([]) do |account, result|
result << uri_for(account)
result << account.followers_url if account.group?
result << account_followers_url(account) if account.group?
end)
cc.concat(FollowRequest.where(target_account_id: status.account_id, account_id: account_ids).each_with_object([]) do |request, result|
result << uri_for(request.account)
result << request.account.followers_url if request.account.group?
result << account_followers_url(request.account) if request.account.group?
end)
else
cc.concat(status.active_mentions.each_with_object([]) do |mention, result|
result << uri_for(mention.account)
result << mention.account.followers_url if mention.account.group?
result << account_followers_url(mention.account) if mention.account.group?
end)
end
end

View File

@ -55,7 +55,7 @@ class ProofProvider::Keybase::ConfigSerializer < ActiveModel::Serializer
end
def profile_url
CGI.unescape(short_account_url('%{username}')) # rubocop:disable Style/FormatStringToken
CGI.unescape(short_account_url('%{username}'))
end
def check_url

View File

@ -231,6 +231,7 @@ class Request
begin
sock.connect_nonblock(addr_by_socket[sock])
rescue Errno::EISCONN
# Do nothing
rescue => e
sock.close
outer_e = e

View File

@ -12,7 +12,7 @@ module Settings
@object = object
end
# rubocop:disable Style/MethodMissing
# rubocop:disable Style/MethodMissingSuper
def method_missing(method, *args)
method_name = method.to_s
# set a value for a variable
@ -25,7 +25,7 @@ module Settings
self[method_name]
end
end
# rubocop:enable Style/MethodMissing
# rubocop:enable Style/MethodMissingSuper
def respond_to_missing?(*)
true
@ -49,7 +49,6 @@ module Settings
record.update!(value: value)
Rails.cache.write(Setting.cache_key(key, @object), value)
value
end
def [](key)