Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - app/controllers/auth/sessions_controller.rb Upstream reverted something we partially reverted already. Reverted the rest to match upstream.
This commit is contained in:
@@ -61,10 +61,8 @@ class FanOutOnWriteService < BaseService
|
||||
def deliver_to_mentioned_followers(status)
|
||||
Rails.logger.debug "Delivering status #{status.id} to limited followers"
|
||||
|
||||
status.mentions.includes(:account).each do |mention|
|
||||
mentioned_account = mention.account
|
||||
next if !mentioned_account.local? || !mentioned_account.following?(status.account) || FeedManager.instance.filter?(:home, status, mention.account_id)
|
||||
FeedManager.instance.push_to_home(mentioned_account, status)
|
||||
FeedInsertWorker.push_bulk(status.mentions.includes(:account).map(&:account).select { |mentioned_account| mentioned_account.local? && mentioned_account.following?(status.account) }) do |follower|
|
||||
[status.id, follower.id, :home]
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -29,7 +29,7 @@ class FetchAtomService < BaseService
|
||||
|
||||
def perform_request(&block)
|
||||
accept = 'text/html'
|
||||
accept = 'application/activity+json, application/ld+json, application/atom+xml, ' + accept unless @unsupported_activity
|
||||
accept = 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams", application/atom+xml, ' + accept unless @unsupported_activity
|
||||
|
||||
Request.new(:get, @url).add_headers('Accept' => accept).perform(&block)
|
||||
end
|
||||
@@ -37,9 +37,11 @@ class FetchAtomService < BaseService
|
||||
def process_response(response, terminal = false)
|
||||
return nil if response.code != 200
|
||||
|
||||
if response.mime_type == 'application/atom+xml'
|
||||
response_type = response.headers['Content-type']
|
||||
|
||||
if response_type == 'application/atom+xml'
|
||||
[@url, { prefetched_body: response.body_with_limit }, :ostatus]
|
||||
elsif ['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'].include?(response.mime_type)
|
||||
elsif ['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'].include?(response_type)
|
||||
body = response.body_with_limit
|
||||
json = body_to_json(body)
|
||||
if supported_context?(json) && equals_or_includes_any?(json['type'], ActivityPub::FetchRemoteAccountService::SUPPORTED_TYPES) && json['inbox'].present?
|
||||
@@ -55,7 +57,7 @@ class FetchAtomService < BaseService
|
||||
|
||||
if link_header&.find_link(%w(rel alternate))
|
||||
process_link_headers(link_header)
|
||||
elsif response.mime_type == 'text/html'
|
||||
elsif response_type == 'text/html'
|
||||
process_html(response)
|
||||
end
|
||||
end
|
||||
|
@@ -17,8 +17,7 @@ class FetchLinkCardService < BaseService
|
||||
|
||||
return if @url.nil? || @status.preview_cards.any?
|
||||
|
||||
@mentions = status.mentions
|
||||
@url = @url.to_s
|
||||
@url = @url.to_s
|
||||
|
||||
RedisLock.acquire(lock_options) do |lock|
|
||||
if lock.acquired?
|
||||
@@ -84,9 +83,8 @@ class FetchLinkCardService < BaseService
|
||||
end
|
||||
|
||||
def mention_link?(a)
|
||||
return false if @mentions.nil?
|
||||
@mentions.any? do |mention|
|
||||
a['href'] == TagManager.instance.url_for(mention.target)
|
||||
@status.mentions.any? do |mention|
|
||||
a['href'] == TagManager.instance.url_for(mention.account)
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -51,8 +51,12 @@ class NotifyService < BaseService
|
||||
@recipient.user.settings.interactions['must_be_following'] && !following_sender?
|
||||
end
|
||||
|
||||
def message?
|
||||
@notification.type == :mention
|
||||
end
|
||||
|
||||
def direct_message?
|
||||
@notification.type == :mention && @notification.target_status.direct_visibility?
|
||||
message? && @notification.target_status.direct_visibility?
|
||||
end
|
||||
|
||||
def response_to_recipient?
|
||||
@@ -66,7 +70,6 @@ class NotifyService < BaseService
|
||||
def optional_non_following_and_direct?
|
||||
direct_message? &&
|
||||
@recipient.user.settings.interactions['must_be_following_dm'] &&
|
||||
!from_staff? &&
|
||||
!following_sender? &&
|
||||
!response_to_recipient?
|
||||
end
|
||||
@@ -86,6 +89,9 @@ class NotifyService < BaseService
|
||||
def blocked?
|
||||
blocked = @recipient.suspended? # Skip if the recipient account is suspended anyway
|
||||
blocked ||= from_self? # Skip for interactions with self
|
||||
|
||||
return blocked if message? && from_staff?
|
||||
|
||||
blocked ||= domain_blocking? # Skip for domain blocked accounts
|
||||
blocked ||= @recipient.blocking?(@notification.from_account) # Skip for blocked accounts
|
||||
blocked ||= @recipient.muting_notifications?(@notification.from_account)
|
||||
|
Reference in New Issue
Block a user