Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
This commit is contained in:
@@ -18,7 +18,7 @@ class AccountSearchService < BaseService
|
||||
return [] if query_blank_or_hashtag? || limit < 1
|
||||
|
||||
if resolving_non_matching_remote_account?
|
||||
[ResolveRemoteAccountService.new.call("#{query_username}@#{query_domain}")].compact
|
||||
[ResolveAccountService.new.call("#{query_username}@#{query_domain}")].compact
|
||||
else
|
||||
search_results_and_exact_match.compact.uniq.slice(0, limit)
|
||||
end
|
||||
|
||||
@@ -18,6 +18,6 @@ module AuthorExtractor
|
||||
acct = "#{username}@#{domain}"
|
||||
end
|
||||
|
||||
ResolveRemoteAccountService.new.call(acct, update_profile)
|
||||
ResolveAccountService.new.call(acct, update_profile)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ class FollowService < BaseService
|
||||
# @param [true, false, nil] reblogs Whether or not to show reblogs, defaults to true
|
||||
def call(source_account, uri, reblogs: nil)
|
||||
reblogs = true if reblogs.nil?
|
||||
target_account = uri.is_a?(Account) ? uri : ResolveRemoteAccountService.new.call(uri)
|
||||
target_account = uri.is_a?(Account) ? uri : ResolveAccountService.new.call(uri)
|
||||
|
||||
raise ActiveRecord::RecordNotFound if target_account.nil? || target_account.id == source_account.id || target_account.suspended?
|
||||
raise Mastodon::NotPermittedError if target_account.blocking?(source_account) || source_account.blocking?(target_account)
|
||||
|
||||
@@ -16,7 +16,7 @@ class ProcessMentionsService < BaseService
|
||||
|
||||
if mention_undeliverable?(status, mentioned_account)
|
||||
begin
|
||||
mentioned_account = resolve_remote_account_service.call($1)
|
||||
mentioned_account = resolve_account_service.call($1)
|
||||
rescue Goldfinger::Error, HTTP::Error
|
||||
mentioned_account = nil
|
||||
end
|
||||
@@ -63,7 +63,7 @@ class ProcessMentionsService < BaseService
|
||||
).as_json).sign!(status.account))
|
||||
end
|
||||
|
||||
def resolve_remote_account_service
|
||||
ResolveRemoteAccountService.new
|
||||
def resolve_account_service
|
||||
ResolveAccountService.new
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ResolveRemoteAccountService < BaseService
|
||||
class ResolveAccountService < BaseService
|
||||
include OStatus2::MagicKey
|
||||
include JsonLdHelper
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FetchRemoteResourceService < BaseService
|
||||
class ResolveURLService < BaseService
|
||||
include JsonLdHelper
|
||||
|
||||
attr_reader :url
|
||||
@@ -8,7 +8,7 @@ class SearchService < BaseService
|
||||
|
||||
default_results.tap do |results|
|
||||
if url_query?
|
||||
results.merge!(remote_resource_results) unless remote_resource.nil?
|
||||
results.merge!(url_resource_results) unless url_resource.nil?
|
||||
elsif query.present?
|
||||
results[:accounts] = AccountSearchService.new.call(query, limit, account, resolve: resolve)
|
||||
results[:hashtags] = Tag.search_for(query.gsub(/\A#/, ''), limit) unless query.start_with?('@')
|
||||
@@ -24,15 +24,15 @@ class SearchService < BaseService
|
||||
query =~ /\Ahttps?:\/\//
|
||||
end
|
||||
|
||||
def remote_resource_results
|
||||
{ remote_resource_symbol => [remote_resource] }
|
||||
def url_resource_results
|
||||
{ url_resource_symbol => [url_resource] }
|
||||
end
|
||||
|
||||
def remote_resource
|
||||
@_remote_resource ||= FetchRemoteResourceService.new.call(query)
|
||||
def url_resource
|
||||
@_url_resource ||= ResolveURLService.new.call(query)
|
||||
end
|
||||
|
||||
def remote_resource_symbol
|
||||
remote_resource.class.name.downcase.pluralize.to_sym
|
||||
def url_resource_symbol
|
||||
url_resource.class.name.downcase.pluralize.to_sym
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user