aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-28 14:57:51 +0200
committerChocobozzz <me@florianbigard.com>2022-06-28 15:06:15 +0200
commit4fae2b1f300c1f027629569817262f60873a663a (patch)
treefabffae6d39aa13b19985f8c92730db2a721dceb /server/lib/activitypub/process
parent4c8336af67bf4e570e227d5cb1fbcb7a53b3776e (diff)
downloadPeerTube-4fae2b1f300c1f027629569817262f60873a663a.tar.gz
PeerTube-4fae2b1f300c1f027629569817262f60873a663a.tar.zst
PeerTube-4fae2b1f300c1f027629569817262f60873a663a.zip
Rename video full loading
Diffstat (limited to 'server/lib/activitypub/process')
-rw-r--r--server/lib/activitypub/process/process-dislike.ts2
-rw-r--r--server/lib/activitypub/process/process-like.ts2
-rw-r--r--server/lib/activitypub/process/process-undo.ts4
3 files changed, 4 insertions, 4 deletions
diff --git a/server/lib/activitypub/process/process-dislike.ts b/server/lib/activitypub/process/process-dislike.ts
index 97a994e94..44e349b22 100644
--- a/server/lib/activitypub/process/process-dislike.ts
+++ b/server/lib/activitypub/process/process-dislike.ts
@@ -35,7 +35,7 @@ async function processDislike (activity: ActivityCreate | ActivityDislike, byAct
35 if (!onlyVideo.isOwned()) return 35 if (!onlyVideo.isOwned()) return
36 36
37 return sequelizeTypescript.transaction(async t => { 37 return sequelizeTypescript.transaction(async t => {
38 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) 38 const video = await VideoModel.loadFull(onlyVideo.id, t)
39 39
40 const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) 40 const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t)
41 if (existingRate && existingRate.type === 'dislike') return 41 if (existingRate && existingRate.type === 'dislike') return
diff --git a/server/lib/activitypub/process/process-like.ts b/server/lib/activitypub/process/process-like.ts
index 1aee756d8..580a05bcd 100644
--- a/server/lib/activitypub/process/process-like.ts
+++ b/server/lib/activitypub/process/process-like.ts
@@ -34,7 +34,7 @@ async function processLikeVideo (byActor: MActorSignature, activity: ActivityLik
34 if (!onlyVideo.isOwned()) return 34 if (!onlyVideo.isOwned()) return
35 35
36 return sequelizeTypescript.transaction(async t => { 36 return sequelizeTypescript.transaction(async t => {
37 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) 37 const video = await VideoModel.loadFull(onlyVideo.id, t)
38 38
39 const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t) 39 const existingRate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byAccount.id, video.id, activity.id, t)
40 if (existingRate && existingRate.type === 'like') return 40 if (existingRate && existingRate.type === 'like') return
diff --git a/server/lib/activitypub/process/process-undo.ts b/server/lib/activitypub/process/process-undo.ts
index 257eb6c2b..778a38e05 100644
--- a/server/lib/activitypub/process/process-undo.ts
+++ b/server/lib/activitypub/process/process-undo.ts
@@ -63,7 +63,7 @@ async function processUndoLike (byActor: MActorSignature, activity: ActivityUndo
63 return sequelizeTypescript.transaction(async t => { 63 return sequelizeTypescript.transaction(async t => {
64 if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) 64 if (!byActor.Account) throw new Error('Unknown account ' + byActor.url)
65 65
66 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) 66 const video = await VideoModel.loadFull(onlyVideo.id, t)
67 const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, likeActivity.id, t) 67 const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, likeActivity.id, t)
68 if (!rate || rate.type !== 'like') throw new Error(`Unknown like by account ${byActor.Account.id} for video ${video.id}.`) 68 if (!rate || rate.type !== 'like') throw new Error(`Unknown like by account ${byActor.Account.id} for video ${video.id}.`)
69 69
@@ -87,7 +87,7 @@ async function processUndoDislike (byActor: MActorSignature, activity: ActivityU
87 return sequelizeTypescript.transaction(async t => { 87 return sequelizeTypescript.transaction(async t => {
88 if (!byActor.Account) throw new Error('Unknown account ' + byActor.url) 88 if (!byActor.Account) throw new Error('Unknown account ' + byActor.url)
89 89
90 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(onlyVideo.id, t) 90 const video = await VideoModel.loadFull(onlyVideo.id, t)
91 const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislike.id, t) 91 const rate = await AccountVideoRateModel.loadByAccountAndVideoOrUrl(byActor.Account.id, video.id, dislike.id, t)
92 if (!rate || rate.type !== 'dislike') throw new Error(`Unknown dislike by account ${byActor.Account.id} for video ${video.id}.`) 92 if (!rate || rate.type !== 'dislike') throw new Error(`Unknown dislike by account ${byActor.Account.id} for video ${video.id}.`)
93 93