mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Put activity pub sends inside transactions
This commit is contained in:
parent
5cd8054542
commit
25ed141c7c
21 changed files with 144 additions and 113 deletions
|
@ -5,17 +5,17 @@ import { AccountFollowInstance } from '../../../models/account/account-follow-in
|
|||
import { getAccountFollowActivityPubUrl } from '../url'
|
||||
import { unicastTo } from './misc'
|
||||
|
||||
async function sendFollow (accountFollow: AccountFollowInstance, t: Transaction) {
|
||||
function sendFollow (accountFollow: AccountFollowInstance, t: Transaction) {
|
||||
const me = accountFollow.AccountFollower
|
||||
const following = accountFollow.AccountFollowing
|
||||
|
||||
const url = getAccountFollowActivityPubUrl(accountFollow)
|
||||
const data = await followActivityData(url, me, following)
|
||||
const data = followActivityData(url, me, following)
|
||||
|
||||
return unicastTo(data, me, following.inboxUrl, t)
|
||||
}
|
||||
|
||||
async function followActivityData (url: string, byAccount: AccountInstance, targetAccount: AccountInstance) {
|
||||
function followActivityData (url: string, byAccount: AccountInstance, targetAccount: AccountInstance) {
|
||||
const activity: ActivityFollow = {
|
||||
type: 'Follow',
|
||||
id: url,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue