import { AccountInstance } from '../../../models/account/account-interface'
import { logger } from '../../../helpers/logger'
import { sendAccept } from '../send/send-accept'
-import { getOrCreateAccount } from '../account'
+import { getOrCreateAccountAndServer } from '../account'
async function processFollowActivity (activity: ActivityFollow) {
const activityObject = activity.object
- const account = await getOrCreateAccount(activity.actor)
+ const account = await getOrCreateAccountAndServer(activity.actor)
return processFollow(account, activityObject)
}
},
transaction: t
})
+
+ if (accountFollow.state !== 'accepted') {
+ accountFollow.state = 'accepted'
+ await accountFollow.save({ transaction: t })
+ }
+
accountFollow.AccountFollower = account
accountFollow.AccountFollowing = targetAccount