diff options
author | Starfall <us@starfall.systems> | 2021-01-26 16:42:38 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2021-01-26 16:42:38 -0600 |
commit | 3ef928029d94a2b3c6abf96a2935de85c4eed6c8 (patch) | |
tree | d8697b527a0a42e51634b1fef68f0162fe2ccbe2 /app/services | |
parent | 65263e6309fb4dea1a93d4b4806af629d317c156 (diff) | |
parent | 52ff3ca675ecac0ff32990b6321fb5e349e6dc59 (diff) |
Merge remote-tracking branch 'glitchsoc/main' into main
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/account_search_service.rb | 2 | ||||
-rw-r--r-- | app/services/activitypub/fetch_featured_collection_service.rb | 7 | ||||
-rw-r--r-- | app/services/fetch_link_card_service.rb | 4 | ||||
-rw-r--r-- | app/services/search_service.rb | 2 |
4 files changed, 6 insertions, 9 deletions
diff --git a/app/services/account_search_service.rb b/app/services/account_search_service.rb index 43e596040..6fe4b6593 100644 --- a/app/services/account_search_service.rb +++ b/app/services/account_search_service.rb @@ -175,7 +175,7 @@ class AccountSearchService < BaseService end def username_complete? - query.include?('@') && "@#{query}" =~ /\A#{Account::MENTION_RE}\Z/ + query.include?('@') && "@#{query}".match?(/\A#{Account::MENTION_RE}\Z/) end def likely_acct? diff --git a/app/services/activitypub/fetch_featured_collection_service.rb b/app/services/activitypub/fetch_featured_collection_service.rb index 82c861f5b..72352aca6 100644 --- a/app/services/activitypub/fetch_featured_collection_service.rb +++ b/app/services/activitypub/fetch_featured_collection_service.rb @@ -23,11 +23,8 @@ class ActivityPub::FetchFeaturedCollectionService < BaseService def process_items(items) status_ids = items.map { |item| value_or_id(item) } - .reject { |uri| ActivityPub::TagManager.instance.local_uri?(uri) } - .filter_map { |uri| ActivityPub::FetchRemoteStatusService.new.call(uri) } - .select { |status| status.account_id == @account.id } - .map(&:id) - + .filter_map { |uri| ActivityPub::FetchRemoteStatusService.new.call(uri) unless ActivityPub::TagManager.instance.local_uri?(uri) } + .filter_map { |status| status.id if status.account_id == @account.id } to_remove = [] to_add = status_ids diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb index 255490d5c..74fe9a0a5 100644 --- a/app/services/fetch_link_card_service.rb +++ b/app/services/fetch_link_card_service.rb @@ -47,11 +47,11 @@ class FetchLinkCardService < BaseService Request.new(:get, @url).add_headers('Accept' => 'text/html', 'User-Agent' => Mastodon::Version.user_agent + ' Bot').perform do |res| if res.code == 200 && res.mime_type == 'text/html' - @html = res.body_with_limit @html_charset = res.charset + @html = res.body_with_limit else - @html = nil @html_charset = nil + @html = nil end end end diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 19500a8d4..1a76cbb38 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -72,7 +72,7 @@ class SearchService < BaseService end def url_query? - @resolve && @query =~ /\Ahttps?:\/\// + @resolve && /\Ahttps?:\/\//.match?(@query) end def url_resource_results |