0
0
Fork 0

Store URIs of follows, follow requests and blocks for ActivityPub (#7160)

Same URI passed between follow request and follow, since they are
the same thing in ActivityPub. Local URIs are generated during
creation using UUIDs and are passed to serializers.
This commit is contained in:
Eugen Rochko 2018-05-04 21:14:34 +02:00 committed by GitHub
parent d1aef17f9a
commit 6793bec4c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 64 additions and 13 deletions

View file

@ -82,16 +82,19 @@ module AccountInteractions
has_many :domain_blocks, class_name: 'AccountDomainBlock', dependent: :destroy
end
def follow!(other_account, reblogs: nil)
def follow!(other_account, reblogs: nil, uri: nil)
reblogs = true if reblogs.nil?
rel = active_relationships.create_with(show_reblogs: reblogs).find_or_create_by!(target_account: other_account)
rel.update!(show_reblogs: reblogs)
rel = active_relationships.create_with(show_reblogs: reblogs, uri: uri)
.find_or_create_by!(target_account: other_account)
rel.update!(show_reblogs: reblogs)
rel
end
def block!(other_account)
block_relationships.find_or_create_by!(target_account: other_account)
def block!(other_account, uri: nil)
block_relationships.create_with(uri: uri)
.find_or_create_by!(target_account: other_account)
end
def mute!(other_account, notifications: nil)