-async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateType) {
- await Bluebird.map(ratesUrl, async rateUrl => {
- try {
- // Fetch url
- const { body } = await doJSONRequest<any>(rateUrl, { activityPub: true })
- if (!body || !body.actor) throw new Error('Body or body actor is invalid')
-
- const actorUrl = getAPId(body.actor)
- if (checkUrlsSameHost(actorUrl, rateUrl) !== true) {
- throw new Error(`Rate url ${rateUrl} has not the same host than actor url ${actorUrl}`)
- }
+async function sendVideoRateChange (
+ account: MAccountActor,
+ video: MVideoFullLight,
+ likes: number,
+ dislikes: number,
+ t: Transaction
+) {
+ if (video.isOwned()) return federateVideoIfNeeded(video, false, t)