From 6a96af4d20129cea06c716393338aa4f730b7b35 Mon Sep 17 00:00:00 2001 From: abcang Date: Wed, 15 Jul 2020 02:05:07 +0900 Subject: Fix rubocop warning (#14288) * Fix rubocop warning * use limit variable * use ContextCreatingMethods option --- app/lib/activitypub/activity/create.rb | 2 +- app/lib/proof_provider/keybase/config_serializer.rb | 2 +- app/lib/request.rb | 1 + app/lib/settings/scoped_settings.rb | 5 ++--- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'app/lib') diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index d3d460551..e81452e3c 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -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 diff --git a/app/lib/proof_provider/keybase/config_serializer.rb b/app/lib/proof_provider/keybase/config_serializer.rb index fbce7aeee..c6c364d31 100644 --- a/app/lib/proof_provider/keybase/config_serializer.rb +++ b/app/lib/proof_provider/keybase/config_serializer.rb @@ -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 diff --git a/app/lib/request.rb b/app/lib/request.rb index 247c32958..bcba1eebf 100644 --- a/app/lib/request.rb +++ b/app/lib/request.rb @@ -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 diff --git a/app/lib/settings/scoped_settings.rb b/app/lib/settings/scoped_settings.rb index 9ca39510a..3bec9bd56 100644 --- a/app/lib/settings/scoped_settings.rb +++ b/app/lib/settings/scoped_settings.rb @@ -11,7 +11,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 @@ -24,7 +24,7 @@ module Settings self[method_name] end end - # rubocop:enable Style/MethodMissing + # rubocop:enable Style/MethodMissingSuper def respond_to_missing?(*) true @@ -48,7 +48,6 @@ module Settings record.update!(value: value) Rails.cache.write(Setting.cache_key(key, @object), value) - value end def [](key) -- cgit From 5c23ec2fa668c9a0b25681349f7e73e1dfb68ecd Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Wed, 15 Jul 2020 02:05:34 +0900 Subject: Improve group processing (#14279) * Fix the local group's followers collection * Fix to accept followed relayed_through_account * Add local delivery to the group's followers * Fix code style * Revert "Add local delivery to the group's followers" This reverts commit 3237effc199772e4c4d30f19082cbc5633f56196. --- app/lib/activitypub/activity.rb | 2 +- app/lib/activitypub/tag_manager.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'app/lib') diff --git a/app/lib/activitypub/activity.rb b/app/lib/activitypub/activity.rb index 58cec7ac4..0ce279d28 100644 --- a/app/lib/activitypub/activity.rb +++ b/app/lib/activitypub/activity.rb @@ -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? diff --git a/app/lib/activitypub/tag_manager.rb b/app/lib/activitypub/tag_manager.rb index 1523f86d4..3f98dad2e 100644 --- a/app/lib/activitypub/tag_manager.rb +++ b/app/lib/activitypub/tag_manager.rb @@ -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 -- cgit