diff options
author | Chocobozzz <me@florianbigard.com> | 2019-11-15 15:06:03 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-11-25 10:59:43 +0100 |
commit | d7a25329f9e607894d29ab342b9cb66638b56dc0 (patch) | |
tree | 6cd6bc4f2689f78944238b313c93427423a932ac /server/helpers/database-utils.ts | |
parent | 14981d7331da3f63fe6cfaf020ccb7c910006eaf (diff) | |
download | PeerTube-d7a25329f9e607894d29ab342b9cb66638b56dc0.tar.gz PeerTube-d7a25329f9e607894d29ab342b9cb66638b56dc0.tar.zst PeerTube-d7a25329f9e607894d29ab342b9cb66638b56dc0.zip |
Add ability to disable webtorrent
In favour of HLS
Diffstat (limited to 'server/helpers/database-utils.ts')
-rw-r--r-- | server/helpers/database-utils.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts index 6c5068fb0..87f10f913 100644 --- a/server/helpers/database-utils.ts +++ b/server/helpers/database-utils.ts | |||
@@ -79,6 +79,15 @@ function afterCommitIfTransaction (t: Transaction, fn: Function) { | |||
79 | return fn() | 79 | return fn() |
80 | } | 80 | } |
81 | 81 | ||
82 | function deleteNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean } & Model<T>> ( | ||
83 | fromDatabase: T[], | ||
84 | newModels: T[], | ||
85 | t: Transaction | ||
86 | ) { | ||
87 | return fromDatabase.filter(f => !newModels.find(newModel => newModel.hasSameUniqueKeysThan(f))) | ||
88 | .map(f => f.destroy({ transaction: t })) | ||
89 | } | ||
90 | |||
82 | // --------------------------------------------------------------------------- | 91 | // --------------------------------------------------------------------------- |
83 | 92 | ||
84 | export { | 93 | export { |
@@ -86,5 +95,6 @@ export { | |||
86 | retryTransactionWrapper, | 95 | retryTransactionWrapper, |
87 | transactionRetryer, | 96 | transactionRetryer, |
88 | updateInstanceWithAnother, | 97 | updateInstanceWithAnother, |
89 | afterCommitIfTransaction | 98 | afterCommitIfTransaction, |
99 | deleteNonExistingModels | ||
90 | } | 100 | } |