diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-11-23 23:10:05 -0600 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-11-23 23:10:05 -0600 |
commit | 65a9abb315f18ac777f3d0e09b3f7399830ad243 (patch) | |
tree | 39712b50201749efad11dce09561d81f4bdcdb2f /app/services | |
parent | 7f5ba917563aa1c9a373d9dd3a6a29f73d81ee9a (diff) |
Add user options to disable recipient verification, allow anonymous public access; rework private mode
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/activitypub/process_account_service.rb | 1 | ||||
-rw-r--r-- | app/services/concerns/payloadable.rb | 6 | ||||
-rw-r--r-- | app/services/fan_out_on_write_service.rb | 9 | ||||
-rw-r--r-- | app/services/process_hashtags_service.rb | 4 | ||||
-rw-r--r-- | app/services/reblog_service.rb | 2 | ||||
-rw-r--r-- | app/services/remove_hashtags_service.rb | 2 | ||||
-rw-r--r-- | app/services/remove_status_service.rb | 6 | ||||
-rw-r--r-- | app/services/revoke_status_service.rb | 6 |
8 files changed, 14 insertions, 22 deletions
diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index ec1041b3d..049ceae83 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -95,7 +95,6 @@ class ActivityPub::ProcessAccountService < BaseService @account.show_replies = @json['showReplies'] || true @account.show_unlisted = @json['showUnlisted'] || true @account.private = @json['private'] || false - @account.require_auth = @json['require_auth'] || false end def set_fetchable_attributes! diff --git a/app/services/concerns/payloadable.rb b/app/services/concerns/payloadable.rb index ba94539c8..1492f8076 100644 --- a/app/services/concerns/payloadable.rb +++ b/app/services/concerns/payloadable.rb @@ -7,14 +7,10 @@ module Payloadable payload = ActiveModelSerializers::SerializableResource.new(record, options.merge(serializer: serializer, adapter: ActivityPub::Adapter)).as_json object = record.respond_to?(:virtual_object) ? record.virtual_object : record - if (object.respond_to?(:sign?) && object.sign?) && signer && signing_enabled? + if (object.respond_to?(:sign?) && object.sign?) && signer && !signer.allow_anonymous? ActivityPub::LinkedDataSignature.new(payload).sign!(signer, sign_with: sign_with) else payload end end - - def signing_enabled? - true - end end diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 1fa8b2520..679ba8501 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -21,15 +21,12 @@ class FanOutOnWriteService < BaseService deliver_to_lists(status) end - return if status.account.silenced? + return if !status.public_visibility? || status.account.silenced? return if status.reblog? && !Setting.show_reblogs_in_public_timelines - if status.distributable? - render_anonymous_payload(status) - deliver_to_hashtags(status) - end + render_anonymous_payload(status) + deliver_to_hashtags(status) - return unless status.public_visibility? return if status.reply? && status.in_reply_to_account_id != status.account_id && !Setting.show_replies_in_public_timelines deliver_to_public(status) diff --git a/app/services/process_hashtags_service.rb b/app/services/process_hashtags_service.rb index 5ec5ea0c2..51c152164 100644 --- a/app/services/process_hashtags_service.rb +++ b/app/services/process_hashtags_service.rb @@ -13,10 +13,10 @@ class ProcessHashtagsService < BaseService status.tags << tag records << tag - TrendingTags.record_use!(tag, status.account, status.created_at) if status.distributable? + TrendingTags.record_use!(tag, status.account, status.created_at) if status.public_visibility? end - return unless status.distributable? + return unless status.public_visibility? status.account.featured_tags.where(tag_id: records.map(&:id)).each do |featured_tag| featured_tag.increment(status.created_at) diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb index ef7468194..b694bc500 100644 --- a/app/services/reblog_service.rb +++ b/app/services/reblog_service.rb @@ -32,7 +32,7 @@ class ReblogService < BaseService curate!(reblogged_status) unless reblogged_status.curated? || !reblogged_status.published? DistributionWorker.perform_async(reblog.id) - ActivityPub::DistributionWorker.perform_async(reblog.id) unless reblogged_status.local_only? + ActivityPub::DistributionWorker.perform_async(reblog.id) unless reblogged_status.local_only? || reblogged_status.account.private? create_notification(reblog) bump_potential_friendship(account, reblog) diff --git a/app/services/remove_hashtags_service.rb b/app/services/remove_hashtags_service.rb index 6bf77a068..af2ba6f8c 100644 --- a/app/services/remove_hashtags_service.rb +++ b/app/services/remove_hashtags_service.rb @@ -8,7 +8,7 @@ class RemoveHashtagsService < BaseService featured_tag.decrement(status.id) end - if status.distributable? + if status.public_visibility? delete_payload = Oj.dump(event: :delete, payload: status.id.to_s) tags.pluck(:name).each do |hashtag| redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", delete_payload) diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index beb415f94..e6ecfbc56 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -144,7 +144,7 @@ class RemoveStatusService < BaseService featured_tag.decrement(@status.id) end - return unless @status.distributable? + return unless @status.public_visibility? @tags.each do |hashtag| redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", @payload) @@ -153,7 +153,7 @@ class RemoveStatusService < BaseService end def remove_from_public - return unless @status.distributable? + return unless @status.public_visibility? redis.publish('timeline:public', @payload) redis.publish('timeline:public:local', @payload) if @status.local? @@ -161,7 +161,7 @@ class RemoveStatusService < BaseService end def remove_from_media - return unless @status.distributable? + return unless @status.public_visibility? redis.publish('timeline:public:media', @payload) redis.publish('timeline:public:local:media', @payload) if @status.local? diff --git a/app/services/revoke_status_service.rb b/app/services/revoke_status_service.rb index f4762631c..d860ab278 100644 --- a/app/services/revoke_status_service.rb +++ b/app/services/revoke_status_service.rb @@ -62,7 +62,7 @@ class RevokeStatusService < BaseService featured_tag.decrement(@status.id) end - return unless @status.distributable? + return unless @status.public_visibility? @tags.each do |hashtag| redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", @payload) @@ -71,7 +71,7 @@ class RevokeStatusService < BaseService end def remove_from_public - return if @status.distributable? + return if @status.public_visibility? redis.publish('timeline:public', @payload) redis.publish('timeline:public:local', @payload) if @status.local? @@ -79,7 +79,7 @@ class RevokeStatusService < BaseService end def remove_from_media - return if @status.distributable? + return if @status.public_visibility? redis.publish('timeline:public:media', @payload) redis.publish('timeline:public:local:media', @payload) if @status.local? |