aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
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
parent4c8336af67bf4e570e227d5cb1fbcb7a53b3776e (diff)
downloadPeerTube-4fae2b1f300c1f027629569817262f60873a663a.tar.gz
PeerTube-4fae2b1f300c1f027629569817262f60873a663a.tar.zst
PeerTube-4fae2b1f300c1f027629569817262f60873a663a.zip
Rename video full loading
Diffstat (limited to 'server/lib/activitypub')
-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
-rw-r--r--server/lib/activitypub/send/send-undo.ts2
-rw-r--r--server/lib/activitypub/send/send-update.ts2
5 files changed, 6 insertions, 6 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
diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts
index 442178c42..b8eb47ff6 100644
--- a/server/lib/activitypub/send/send-undo.ts
+++ b/server/lib/activitypub/send/send-undo.ts
@@ -83,7 +83,7 @@ async function sendUndoCacheFile (byActor: MActor, redundancyModel: MVideoRedund
83 return 83 return
84 } 84 }
85 85
86 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(associatedVideo.id) 86 const video = await VideoModel.loadFull(associatedVideo.id)
87 const createActivity = buildCreateActivity(redundancyModel.url, byActor, redundancyModel.toActivityPubObject()) 87 const createActivity = buildCreateActivity(redundancyModel.url, byActor, redundancyModel.toActivityPubObject())
88 88
89 return sendUndoVideoRelatedActivity({ 89 return sendUndoVideoRelatedActivity({
diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts
index 3577ece02..24983dd19 100644
--- a/server/lib/activitypub/send/send-update.ts
+++ b/server/lib/activitypub/send/send-update.ts
@@ -92,7 +92,7 @@ async function sendUpdateCacheFile (byActor: MActorLight, redundancyModel: MVide
92 return 92 return
93 } 93 }
94 94
95 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(associatedVideo.id) 95 const video = await VideoModel.loadFull(associatedVideo.id)
96 96
97 const activityBuilder = (audience: ActivityAudience) => { 97 const activityBuilder = (audience: ActivityAudience) => {
98 const redundancyObject = redundancyModel.toActivityPubObject() 98 const redundancyObject = redundancyModel.toActivityPubObject()