Merge branch 'main' into glitch-soc/merge-upstream
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
class ActivityPub::ProcessAccountService < BaseService
|
||||
include JsonLdHelper
|
||||
include DomainControlHelper
|
||||
include Redisable
|
||||
|
||||
# Should be called with confirmed valid JSON
|
||||
# and WebFinger-resolved username and domain
|
||||
@@ -289,7 +290,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
||||
end
|
||||
|
||||
def lock_options
|
||||
{ redis: Redis.current, key: "process_account:#{@uri}", autorelease: 15.minutes.seconds }
|
||||
{ redis: redis, key: "process_account:#{@uri}", autorelease: 15.minutes.seconds }
|
||||
end
|
||||
|
||||
def process_tags
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
class ActivityPub::ProcessStatusUpdateService < BaseService
|
||||
include JsonLdHelper
|
||||
include Redisable
|
||||
|
||||
def call(status, json)
|
||||
raise ArgumentError, 'Status has unsaved changes' if status.changed?
|
||||
@@ -241,7 +242,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
||||
end
|
||||
|
||||
def lock_options
|
||||
{ redis: Redis.current, key: "create:#{@uri}", autorelease: 15.minutes.seconds }
|
||||
{ redis: redis, key: "create:#{@uri}", autorelease: 15.minutes.seconds }
|
||||
end
|
||||
|
||||
def record_previous_edit!
|
||||
|
@@ -1,6 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FanOutOnWriteService < BaseService
|
||||
include Redisable
|
||||
|
||||
# Push a status into home and mentions feeds
|
||||
# @param [Status] status
|
||||
# @param [Hash] options
|
||||
@@ -107,20 +109,20 @@ class FanOutOnWriteService < BaseService
|
||||
|
||||
def broadcast_to_hashtag_streams!
|
||||
@status.tags.pluck(:name).each do |hashtag|
|
||||
Redis.current.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", anonymous_payload)
|
||||
Redis.current.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}:local", anonymous_payload) if @status.local?
|
||||
redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", anonymous_payload)
|
||||
redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}:local", anonymous_payload) if @status.local?
|
||||
end
|
||||
end
|
||||
|
||||
def broadcast_to_public_streams!
|
||||
return if @status.reply? && @status.in_reply_to_account_id != @account.id && !Setting.show_replies_in_public_timelines
|
||||
|
||||
Redis.current.publish('timeline:public', anonymous_payload)
|
||||
Redis.current.publish(@status.local? ? 'timeline:public:local' : 'timeline:public:remote', anonymous_payload)
|
||||
redis.publish('timeline:public', anonymous_payload)
|
||||
redis.publish(@status.local? ? 'timeline:public:local' : 'timeline:public:remote', anonymous_payload)
|
||||
|
||||
if @status.with_media?
|
||||
Redis.current.publish('timeline:public:media', anonymous_payload)
|
||||
Redis.current.publish(@status.local? ? 'timeline:public:local:media' : 'timeline:public:remote:media', anonymous_payload)
|
||||
redis.publish('timeline:public:media', anonymous_payload)
|
||||
redis.publish(@status.local? ? 'timeline:public:local:media' : 'timeline:public:remote:media', anonymous_payload)
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FetchLinkCardService < BaseService
|
||||
include Redisable
|
||||
|
||||
URL_PATTERN = %r{
|
||||
(#{Twitter::TwitterText::Regex[:valid_url_preceding_chars]}) # $1 preceding chars
|
||||
( # $2 URL
|
||||
@@ -155,6 +157,6 @@ class FetchLinkCardService < BaseService
|
||||
end
|
||||
|
||||
def lock_options
|
||||
{ redis: Redis.current, key: "fetch:#{@original_url}", autorelease: 15.minutes.seconds }
|
||||
{ redis: redis, key: "fetch:#{@original_url}", autorelease: 15.minutes.seconds }
|
||||
end
|
||||
end
|
||||
|
@@ -1,10 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PrecomputeFeedService < BaseService
|
||||
include Redisable
|
||||
|
||||
def call(account)
|
||||
FeedManager.instance.populate_home(account)
|
||||
FeedManager.instance.populate_direct_feed(account)
|
||||
ensure
|
||||
Redis.current.del("account:#{account.id}:regeneration")
|
||||
redis.del("account:#{account.id}:regeneration")
|
||||
end
|
||||
end
|
||||
|
@@ -154,6 +154,6 @@ class RemoveStatusService < BaseService
|
||||
end
|
||||
|
||||
def lock_options
|
||||
{ redis: Redis.current, key: "distribute:#{@status.id}", autorelease: 5.minutes.seconds }
|
||||
{ redis: redis, key: "distribute:#{@status.id}", autorelease: 5.minutes.seconds }
|
||||
end
|
||||
end
|
||||
|
@@ -4,6 +4,7 @@ class ResolveAccountService < BaseService
|
||||
include JsonLdHelper
|
||||
include DomainControlHelper
|
||||
include WebfingerHelper
|
||||
include Redisable
|
||||
|
||||
# Find or create an account record for a remote user. When creating,
|
||||
# look up the user's webfinger and fetch ActivityPub data
|
||||
@@ -147,6 +148,6 @@ class ResolveAccountService < BaseService
|
||||
end
|
||||
|
||||
def lock_options
|
||||
{ redis: Redis.current, key: "resolve:#{@username}@#{@domain}", autorelease: 15.minutes.seconds }
|
||||
{ redis: redis, key: "resolve:#{@username}@#{@domain}", autorelease: 15.minutes.seconds }
|
||||
end
|
||||
end
|
||||
|
@@ -3,6 +3,7 @@
|
||||
class VoteService < BaseService
|
||||
include Authorization
|
||||
include Payloadable
|
||||
include Redisable
|
||||
|
||||
def call(account, poll, choices)
|
||||
authorize_with account, poll, :vote?
|
||||
@@ -77,6 +78,6 @@ class VoteService < BaseService
|
||||
end
|
||||
|
||||
def lock_options
|
||||
{ redis: Redis.current, key: "vote:#{@poll.id}:#{@account.id}" }
|
||||
{ redis: redis, key: "vote:#{@poll.id}:#{@account.id}" }
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user