1
0
Fork 0
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:
Chocobozzz 2017-11-30 11:31:15 +01:00
parent 5cd8054542
commit 25ed141c7c
No known key found for this signature in database
GPG key ID: 583A612D890159BE
21 changed files with 144 additions and 113 deletions

View file

@ -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,