aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/lib/activitypub/actors/refresh.ts10
-rw-r--r--server/lib/activitypub/playlists/refresh.ts2
-rw-r--r--server/lib/activitypub/videos/refresh.ts2
-rw-r--r--server/tests/api/moderation/blocklist.ts4
-rw-r--r--server/tests/api/server/follows.ts2
5 files changed, 14 insertions, 6 deletions
diff --git a/server/lib/activitypub/actors/refresh.ts b/server/lib/activitypub/actors/refresh.ts
index 9758649a5..1f7cfcd8f 100644
--- a/server/lib/activitypub/actors/refresh.ts
+++ b/server/lib/activitypub/actors/refresh.ts
@@ -1,4 +1,4 @@
1import { logger } from '@server/helpers/logger' 1import { logger, loggerTagsFactory } from '@server/helpers/logger'
2import { PeerTubeRequestError } from '@server/helpers/requests' 2import { PeerTubeRequestError } from '@server/helpers/requests'
3import { ActorLoadByUrlType } from '@server/lib/model-loaders' 3import { ActorLoadByUrlType } from '@server/lib/model-loaders'
4import { ActorModel } from '@server/models/actor/actor' 4import { ActorModel } from '@server/models/actor/actor'
@@ -19,6 +19,10 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel
19 ? actorArg as MActorFull 19 ? actorArg as MActorFull
20 : await ActorModel.loadByUrlAndPopulateAccountAndChannel(actorArg.url) 20 : await ActorModel.loadByUrlAndPopulateAccountAndChannel(actorArg.url)
21 21
22 const lTags = loggerTagsFactory('ap', 'actor', 'refresh', actor.url)
23
24 logger.info('Refreshing actor %s.', actor.url, lTags())
25
22 try { 26 try {
23 const actorUrl = await getActorUrl(actor) 27 const actorUrl = await getActorUrl(actor)
24 const { actorObject } = await fetchRemoteActor(actorUrl) 28 const { actorObject } = await fetchRemoteActor(actorUrl)
@@ -34,7 +38,7 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel
34 return { refreshed: true, actor } 38 return { refreshed: true, actor }
35 } catch (err) { 39 } catch (err) {
36 if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) { 40 if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
37 logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url) 41 logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url, lTags())
38 42
39 actor.Account 43 actor.Account
40 ? await actor.Account.destroy() 44 ? await actor.Account.destroy()
@@ -43,7 +47,7 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel
43 return { actor: undefined, refreshed: false } 47 return { actor: undefined, refreshed: false }
44 } 48 }
45 49
46 logger.warn('Cannot refresh actor %s.', actor.url, { err }) 50 logger.warn('Cannot refresh actor %s.', actor.url, { err, ...lTags() })
47 return { actor, refreshed: false } 51 return { actor, refreshed: false }
48 } 52 }
49} 53}
diff --git a/server/lib/activitypub/playlists/refresh.ts b/server/lib/activitypub/playlists/refresh.ts
index ff9e5471a..6f3a6be37 100644
--- a/server/lib/activitypub/playlists/refresh.ts
+++ b/server/lib/activitypub/playlists/refresh.ts
@@ -10,6 +10,8 @@ async function refreshVideoPlaylistIfNeeded (videoPlaylist: MVideoPlaylistOwner)
10 10
11 const lTags = loggerTagsFactory('ap', 'video-playlist', 'refresh', videoPlaylist.uuid, videoPlaylist.url) 11 const lTags = loggerTagsFactory('ap', 'video-playlist', 'refresh', videoPlaylist.uuid, videoPlaylist.url)
12 12
13 logger.info('Refreshing playlist %s.', videoPlaylist.url, lTags())
14
13 try { 15 try {
14 const { playlistObject } = await fetchRemoteVideoPlaylist(videoPlaylist.url) 16 const { playlistObject } = await fetchRemoteVideoPlaylist(videoPlaylist.url)
15 17
diff --git a/server/lib/activitypub/videos/refresh.ts b/server/lib/activitypub/videos/refresh.ts
index 82b3b13bf..a7b82f286 100644
--- a/server/lib/activitypub/videos/refresh.ts
+++ b/server/lib/activitypub/videos/refresh.ts
@@ -22,6 +22,8 @@ async function refreshVideoIfNeeded (options: {
22 22
23 const lTags = loggerTagsFactory('ap', 'video', 'refresh', video.uuid, video.url) 23 const lTags = loggerTagsFactory('ap', 'video', 'refresh', video.uuid, video.url)
24 24
25 logger.info('Refreshing video %s.', video.url, lTags())
26
25 try { 27 try {
26 const { videoObject } = await fetchRemoteVideo(video.url) 28 const { videoObject } = await fetchRemoteVideo(video.url)
27 29
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts
index b767d38c7..793abbcb4 100644
--- a/server/tests/api/moderation/blocklist.ts
+++ b/server/tests/api/moderation/blocklist.ts
@@ -215,7 +215,7 @@ describe('Test blocklist', function () {
215 215
216 const threads: VideoComment[] = resThreads.body.data 216 const threads: VideoComment[] = resThreads.body.data
217 expect(threads).to.have.lengthOf(1) 217 expect(threads).to.have.lengthOf(1)
218 expect(threads[0].totalReplies).to.equal(0) 218 expect(threads[0].totalReplies).to.equal(1)
219 219
220 const t = threads.find(t => t.text === 'comment user 1') 220 const t = threads.find(t => t.text === 'comment user 1')
221 expect(t).to.be.undefined 221 expect(t).to.be.undefined
@@ -565,7 +565,7 @@ describe('Test blocklist', function () {
565 threads = threads.filter(t => t.isDeleted === false) 565 threads = threads.filter(t => t.isDeleted === false)
566 566
567 expect(threads).to.have.lengthOf(1) 567 expect(threads).to.have.lengthOf(1)
568 expect(threads[0].totalReplies).to.equal(0) 568 expect(threads[0].totalReplies).to.equal(1)
569 569
570 const t = threads.find(t => t.text === 'comment user 1') 570 const t = threads.find(t => t.text === 'comment user 1')
571 expect(t).to.be.undefined 571 expect(t).to.be.undefined
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index e1c062020..9e5aa00c7 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -519,7 +519,7 @@ describe('Test follows', function () {
519 expect(deletedComment.text).to.equal('') 519 expect(deletedComment.text).to.equal('')
520 expect(deletedComment.inReplyToCommentId).to.be.null 520 expect(deletedComment.inReplyToCommentId).to.be.null
521 expect(deletedComment.account).to.be.null 521 expect(deletedComment.account).to.be.null
522 expect(deletedComment.totalReplies).to.equal(3) 522 expect(deletedComment.totalReplies).to.equal(2)
523 expect(dateIsValid(deletedComment.deletedAt as string)).to.be.true 523 expect(dateIsValid(deletedComment.deletedAt as string)).to.be.true
524 524
525 const res2 = await getVideoThreadComments(servers[0].url, video4.id, deletedComment.threadId) 525 const res2 = await getVideoThreadComments(servers[0].url, video4.id, deletedComment.threadId)