Skip to content

Commit

Permalink
keyword muting and local only tooting WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrix-bitrot committed Jun 26, 2017
1 parent c0a6658 commit 93fc8aa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/lib/feed_manager.rb
Expand Up @@ -95,6 +95,12 @@ def redis
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]
Expand Down
5 changes: 4 additions & 1 deletion app/services/post_status_service.rb
Expand Up @@ -36,7 +36,10 @@ def call(account, text, in_reply_to = nil, options = {})

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)
Expand Down
5 changes: 4 additions & 1 deletion app/services/reblog_service.rb
Expand Up @@ -20,7 +20,10 @@ def call(account, reblogged_status)
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)
Expand Down

0 comments on commit 93fc8aa

Please sign in to comment.