From 93fc8aa14c914d03643197306c325becbaed2581 Mon Sep 17 00:00:00 2001 From: beatrix-bitrot Date: Mon, 5 Jun 2017 22:34:08 +0000 Subject: [PATCH] keyword muting and local only tooting WIP --- app/lib/feed_manager.rb | 6 ++++++ app/services/post_status_service.rb | 5 ++++- app/services/reblog_service.rb | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 90a1441f29..1885eff26b 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -95,6 +95,12 @@ class FeedManager end def filter_from_home?(status, receiver_id) + # extremely violent filtering code BEGIN + #filter_string = 'e' + #reggie = Regexp.new(filter_string) + #return true if reggie === status.content || reggie === status.spoiler_text + # extremely violent filtering code END + return true if status.reply? && status.in_reply_to_id.nil? check_for_mutes = [status.account_id] diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 2e6fbb5c38..d86ae04d4f 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -36,7 +36,10 @@ class PostStatusService < BaseService LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text? DistributionWorker.perform_async(status.id) - Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id) + + unless /👁$/.match?(status.content) + Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id) + end if options[:idempotency].present? redis.setex("idempotency:status:#{account.id}:#{options[:idempotency]}", 3_600, status.id) diff --git a/app/services/reblog_service.rb b/app/services/reblog_service.rb index ba24b1f9d8..497cdb4f50 100644 --- a/app/services/reblog_service.rb +++ b/app/services/reblog_service.rb @@ -20,7 +20,10 @@ class ReblogService < BaseService reblog = account.statuses.create!(reblog: reblogged_status, text: '') DistributionWorker.perform_async(reblog.id) - Pubsubhubbub::DistributionWorker.perform_async(reblog.stream_entry.id) + unless /👁$/.match?(reblogged_status.content) + Pubsubhubbub::DistributionWorker.perform_async(reblog.stream_entry.id) + end + if reblogged_status.local? NotifyService.new.call(reblog.reblog.account, reblog)