Added pro feed

• Added:
- pro feed
This commit is contained in:
mgabdev
2020-07-01 21:40:00 -04:00
parent 7410c4c6ab
commit bc2eeee497
15 changed files with 230 additions and 9 deletions

View File

@@ -87,6 +87,10 @@ class BatchedRemoveStatusService < BaseService
payload = @json_payloads[status.id]
redis.pipelined do
if status.account.is_pro || status.account.is_donor || status.account.is_investor || status.account.is_verified
redis.publish('timeline:pro', payload)
end
@tags[status.id].each do |hashtag|
redis.publish("timeline:hashtag:#{hashtag}", payload)
redis.publish("timeline:hashtag:#{hashtag}:local", payload) if status.local?

View File

@@ -24,6 +24,11 @@ class FanOutOnWriteService < BaseService
deliver_to_hashtags(status)
return if status.reply? && status.in_reply_to_account_id != status.account_id
if status.account.is_pro || status.account.is_donor || status.account.is_investor || status.account.is_verified
deliver_to_pro(status)
end
end
private
@@ -95,6 +100,12 @@ class FanOutOnWriteService < BaseService
end
end
def deliver_to_pro(status)
Rails.logger.debug "Delivering status #{status.id} to pro timeline"
Redis.current.publish('timeline:pro', @payload)
end
def deliver_to_own_conversation(status)
AccountConversation.add_status(status.account, status)
end

View File

@@ -22,6 +22,7 @@ class RemoveStatusService < BaseService
remove_from_affected
remove_reblogs
remove_from_hashtags
remove_from_pro
@status.destroy!
else
@@ -143,6 +144,12 @@ class RemoveStatusService < BaseService
end
end
def remove_from_pro
if @account.is_pro || @account.is_donor || @account.is_investor || @account.is_verified
redis.publish('timeline:pro', @payload)
end
end
def lock_options
{ redis: Redis.current, key: "distribute:#{@status.id}" }
end