diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-28 10:07:05 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-28 10:07:05 +0200 |
commit | 161b061d4e51eb1e2b2b7e9482d5299489ef7c45 (patch) | |
tree | 5b9524625b7d8dbde765eaf9799d4f272829e449 /server/lib/redundancy.ts | |
parent | d0b52b5285d0797b30bca6510b7a8f840fab4697 (diff) | |
download | PeerTube-161b061d4e51eb1e2b2b7e9482d5299489ef7c45.tar.gz PeerTube-161b061d4e51eb1e2b2b7e9482d5299489ef7c45.tar.zst PeerTube-161b061d4e51eb1e2b2b7e9482d5299489ef7c45.zip |
Remove duplicated videos on unfollow/delete redundancy
Diffstat (limited to 'server/lib/redundancy.ts')
-rw-r--r-- | server/lib/redundancy.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/server/lib/redundancy.ts b/server/lib/redundancy.ts index 16b122658..04d3ded8f 100644 --- a/server/lib/redundancy.ts +++ b/server/lib/redundancy.ts | |||
@@ -12,8 +12,17 @@ async function removeVideoRedundancy (videoRedundancy: VideoRedundancyModel, t?: | |||
12 | await videoRedundancy.destroy({ transaction: t }) | 12 | await videoRedundancy.destroy({ transaction: t }) |
13 | } | 13 | } |
14 | 14 | ||
15 | async function removeRedundancyOf (serverId: number) { | ||
16 | const videosRedundancy = await VideoRedundancyModel.listLocalOfServer(serverId) | ||
17 | |||
18 | for (const redundancy of videosRedundancy) { | ||
19 | await removeVideoRedundancy(redundancy) | ||
20 | } | ||
21 | } | ||
22 | |||
15 | // --------------------------------------------------------------------------- | 23 | // --------------------------------------------------------------------------- |
16 | 24 | ||
17 | export { | 25 | export { |
26 | removeRedundancyOf, | ||
18 | removeVideoRedundancy | 27 | removeVideoRedundancy |
19 | } | 28 | } |