X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fvideo-rates.ts;h=581a2bca1d1f94dcccec032955112baa025d4c21;hb=de94ac86a211dec657332d964693857ec235ce40;hp=79ccfbc7edbba0e8b8c9d27496dec066e7659791;hpb=7024e9120b381b5b3201212f5a18f5cdc14e15ff;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/video-rates.ts b/server/lib/activitypub/video-rates.ts index 79ccfbc7e..581a2bca1 100644 --- a/server/lib/activitypub/video-rates.ts +++ b/server/lib/activitypub/video-rates.ts @@ -8,9 +8,9 @@ import { logger } from '../../helpers/logger' import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants' import { doRequest } from '../../helpers/requests' import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' -import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from './url' +import { getVideoDislikeActivityPubUrlByLocalActor, getVideoLikeActivityPubUrlByLocalActor } from './url' import { sendDislike } from './send/send-dislike' -import { MAccountActor, MActorUrl, MVideo, MVideoAccountLight, MVideoId } from '../../typings/models' +import { MAccountActor, MActorUrl, MVideo, MVideoAccountLight, MVideoId } from '../../types/models' async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateType) { let rateCounts = 0 @@ -18,7 +18,7 @@ async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateTy await Bluebird.map(ratesUrl, async rateUrl => { try { // Fetch url - const { body } = await doRequest({ + const { body } = await doRequest({ uri: rateUrl, json: true, activityPub: true @@ -82,14 +82,14 @@ async function sendVideoRateChange ( if (dislikes > 0) await sendDislike(actor, video, t) } -function getRateUrl (rateType: VideoRateType, actor: MActorUrl, video: MVideoId) { +function getLocalRateUrl (rateType: VideoRateType, actor: MActorUrl, video: MVideoId) { return rateType === 'like' - ? getVideoLikeActivityPubUrl(actor, video) - : getVideoDislikeActivityPubUrl(actor, video) + ? getVideoLikeActivityPubUrlByLocalActor(actor, video) + : getVideoDislikeActivityPubUrlByLocalActor(actor, video) } export { - getRateUrl, + getLocalRateUrl, createRates, sendVideoRateChange }