Autofix Rubocop Style/IfUnlessModifier (#23697)

This commit is contained in:
Nick Schonning 2023-02-18 06:37:47 -05:00 committed by GitHub
parent 9ab2a775c9
commit e2a3ebb271
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 55 additions and 271 deletions

View file

@ -56,9 +56,7 @@ class ActivityPub::FetchRemoteActorService < BaseService
webfinger = webfinger!("acct:#{confirmed_username}@#{confirmed_domain}")
@username, @domain = split_acct(webfinger.subject)
unless confirmed_username.casecmp(@username).zero? && confirmed_domain.casecmp(@domain).zero?
raise Webfinger::RedirectError, "Too many webfinger redirects for URI #{@uri} (stopped at #{@username}@#{@domain})"
end
raise Webfinger::RedirectError, "Too many webfinger redirects for URI #{@uri} (stopped at #{@username}@#{@domain})" unless confirmed_username.casecmp(@username).zero? && confirmed_domain.casecmp(@domain).zero?
raise Error, "Webfinger response for #{@username}@#{@domain} does not loop back to #{@uri}" if webfinger.link('self', 'href') != @uri
rescue Webfinger::RedirectError => e

View file

@ -80,9 +80,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
# If a previously existing media attachment was significantly updated, mark
# media attachments as changed even if none were added or removed
if media_attachment_parser.significantly_changes?(media_attachment)
@media_attachments_changed = true
end
@media_attachments_changed = true if media_attachment_parser.significantly_changes?(media_attachment)
media_attachment.description = media_attachment_parser.description
media_attachment.focus = media_attachment_parser.focus

View file

@ -7,9 +7,7 @@ class RemoveFromFollowersService < BaseService
source_account.passive_relationships.where(account_id: target_accounts).find_each do |follow|
follow.destroy
if source_account.local? && !follow.account.local? && follow.account.activitypub?
create_notification(follow)
end
create_notification(follow) if source_account.local? && !follow.account.local? && follow.account.activitypub?
end
end

View file

@ -96,9 +96,7 @@ class ResolveAccountService < BaseService
@webfinger = webfinger!("acct:#{confirmed_username}@#{confirmed_domain}")
@username, @domain = split_acct(@webfinger.subject)
unless confirmed_username.casecmp(@username).zero? && confirmed_domain.casecmp(@domain).zero?
raise Webfinger::RedirectError, "Too many webfinger redirects for URI #{uri} (stopped at #{@username}@#{@domain})"
end
raise Webfinger::RedirectError, "Too many webfinger redirects for URI #{uri} (stopped at #{@username}@#{@domain})" unless confirmed_username.casecmp(@username).zero? && confirmed_domain.casecmp(@domain).zero?
rescue Webfinger::GoneError
@gone = true
end

View file

@ -37,9 +37,7 @@ class SearchService < BaseService
def perform_statuses_search!
definition = parsed_query.apply(StatusesIndex.filter(term: { searchable_by: @account.id }))
if @options[:account_id].present?
definition = definition.filter(term: { account_id: @options[:account_id] })
end
definition = definition.filter(term: { account_id: @options[:account_id] }) if @options[:account_id].present?
if @options[:min_id].present? || @options[:max_id].present?
range = {}