diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-01-13 21:57:24 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-01-13 21:57:24 -0600 |
commit | 67516a07db44196cc4bb94bf94abe5c6f611cf07 (patch) | |
tree | f65b7c79f859329a0438d806e777fa1d7aa7f400 /app/services/remove_status_service.rb | |
parent | 1fbe7c340201ddff5232c7931a265136943ffd59 (diff) |
add new privacy option to auto-defederate after a given timespan + add options to defederate and/or delete past posts + add `defed_in`/`parent:defed_in`/`thread:defed_in` bangtags + ui indicator for posts marked for auto-defederation
Diffstat (limited to 'app/services/remove_status_service.rb')
-rw-r--r-- | app/services/remove_status_service.rb | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 20648217d..797794a19 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -16,22 +16,24 @@ class RemoveStatusService < BaseService @stream_entry = status.stream_entry @options = options - RedisLock.acquire(lock_options) do |lock| - if lock.acquired? - remove_from_queued - remove_from_self if status.account.local? - remove_from_followers - remove_from_lists - remove_from_affected - remove_reblogs - remove_from_hashtags - remove_from_public - remove_from_media if status.media_attachments.any? - remove_from_direct if status.direct_visibility? - - @status.destroy! - else - raise Mastodon::RaceConditionError + unless options[:defederate_only] + RedisLock.acquire(lock_options) do |lock| + if lock.acquired? + remove_from_queued + remove_from_self if status.account.local? + remove_from_followers + remove_from_lists + remove_from_affected + remove_reblogs + remove_from_hashtags + remove_from_public + remove_from_media if status.media_attachments.any? + remove_from_direct if status.direct_visibility? + + @status.destroy! + else + raise Mastodon::RaceConditionError + end end end @@ -44,6 +46,9 @@ class RemoveStatusService < BaseService remove_from_remote_followers remove_from_remote_affected + + @status.update(local_only: true) if options[:defederate_only] + Rails.cache.delete("statuses/#{@status.id}") end private |