diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-26 14:05:20 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-26 14:05:20 +0200 |
commit | 911238e343e1cccae349ff9c44bcffadb96fa393 (patch) | |
tree | d255f616cc4682f262ec47ce1e0a65478701dcc9 | |
parent | 6cd44728bb49778d6697a0277773ae4fca478a26 (diff) | |
download | PeerTube-911238e343e1cccae349ff9c44bcffadb96fa393.tar.gz PeerTube-911238e343e1cccae349ff9c44bcffadb96fa393.tar.zst PeerTube-911238e343e1cccae349ff9c44bcffadb96fa393.zip |
Fix integrity issues with after destroy hook
-rw-r--r-- | server/lib/friends.ts | 6 | ||||
-rw-r--r-- | server/models/video/author.ts | 4 | ||||
-rw-r--r-- | server/models/video/video-channel.ts | 4 | ||||
-rw-r--r-- | server/models/video/video.ts | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/server/lib/friends.ts b/server/lib/friends.ts index a33432dc1..55cbb55b9 100644 --- a/server/lib/friends.ts +++ b/server/lib/friends.ts | |||
@@ -86,7 +86,7 @@ function updateVideoToFriends (videoData: RemoteVideoUpdateData, transaction: Se | |||
86 | return createRequest(options) | 86 | return createRequest(options) |
87 | } | 87 | } |
88 | 88 | ||
89 | function removeVideoToFriends (videoParams: RemoteVideoRemoveData, transaction: Sequelize.Transaction) { | 89 | function removeVideoToFriends (videoParams: RemoteVideoRemoveData, transaction?: Sequelize.Transaction) { |
90 | const options = { | 90 | const options = { |
91 | type: ENDPOINT_ACTIONS.REMOVE_VIDEO, | 91 | type: ENDPOINT_ACTIONS.REMOVE_VIDEO, |
92 | endpoint: REQUEST_ENDPOINTS.VIDEOS, | 92 | endpoint: REQUEST_ENDPOINTS.VIDEOS, |
@@ -106,7 +106,7 @@ function addVideoAuthorToFriends (authorData: RemoteVideoAuthorCreateData, trans | |||
106 | return createRequest(options) | 106 | return createRequest(options) |
107 | } | 107 | } |
108 | 108 | ||
109 | function removeVideoAuthorToFriends (authorData: RemoteVideoAuthorRemoveData, transaction: Sequelize.Transaction) { | 109 | function removeVideoAuthorToFriends (authorData: RemoteVideoAuthorRemoveData, transaction?: Sequelize.Transaction) { |
110 | const options = { | 110 | const options = { |
111 | type: ENDPOINT_ACTIONS.REMOVE_AUTHOR, | 111 | type: ENDPOINT_ACTIONS.REMOVE_AUTHOR, |
112 | endpoint: REQUEST_ENDPOINTS.VIDEOS, | 112 | endpoint: REQUEST_ENDPOINTS.VIDEOS, |
@@ -136,7 +136,7 @@ function updateVideoChannelToFriends (videoChannelData: RemoteVideoChannelUpdate | |||
136 | return createRequest(options) | 136 | return createRequest(options) |
137 | } | 137 | } |
138 | 138 | ||
139 | function removeVideoChannelToFriends (videoChannelParams: RemoteVideoChannelRemoveData, transaction: Sequelize.Transaction) { | 139 | function removeVideoChannelToFriends (videoChannelParams: RemoteVideoChannelRemoveData, transaction?: Sequelize.Transaction) { |
140 | const options = { | 140 | const options = { |
141 | type: ENDPOINT_ACTIONS.REMOVE_CHANNEL, | 141 | type: ENDPOINT_ACTIONS.REMOVE_CHANNEL, |
142 | endpoint: REQUEST_ENDPOINTS.VIDEOS, | 142 | endpoint: REQUEST_ENDPOINTS.VIDEOS, |
diff --git a/server/models/video/author.ts b/server/models/video/author.ts index 6f27ea7bd..43f84c3ea 100644 --- a/server/models/video/author.ts +++ b/server/models/video/author.ts | |||
@@ -107,13 +107,13 @@ function associate (models) { | |||
107 | }) | 107 | }) |
108 | } | 108 | } |
109 | 109 | ||
110 | function afterDestroy (author: AuthorInstance, options: { transaction: Sequelize.Transaction }) { | 110 | function afterDestroy (author: AuthorInstance) { |
111 | if (author.isOwned()) { | 111 | if (author.isOwned()) { |
112 | const removeVideoAuthorToFriendsParams = { | 112 | const removeVideoAuthorToFriendsParams = { |
113 | uuid: author.uuid | 113 | uuid: author.uuid |
114 | } | 114 | } |
115 | 115 | ||
116 | return removeVideoAuthorToFriends(removeVideoAuthorToFriendsParams, options.transaction) | 116 | return removeVideoAuthorToFriends(removeVideoAuthorToFriendsParams) |
117 | } | 117 | } |
118 | 118 | ||
119 | return undefined | 119 | return undefined |
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index e469383e9..46c2db63f 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -178,13 +178,13 @@ function associate (models) { | |||
178 | }) | 178 | }) |
179 | } | 179 | } |
180 | 180 | ||
181 | function afterDestroy (videoChannel: VideoChannelInstance, options: { transaction: Sequelize.Transaction }) { | 181 | function afterDestroy (videoChannel: VideoChannelInstance) { |
182 | if (videoChannel.isOwned()) { | 182 | if (videoChannel.isOwned()) { |
183 | const removeVideoChannelToFriendsParams = { | 183 | const removeVideoChannelToFriendsParams = { |
184 | uuid: videoChannel.uuid | 184 | uuid: videoChannel.uuid |
185 | } | 185 | } |
186 | 186 | ||
187 | return removeVideoChannelToFriends(removeVideoChannelToFriendsParams, options.transaction) | 187 | return removeVideoChannelToFriends(removeVideoChannelToFriendsParams) |
188 | } | 188 | } |
189 | 189 | ||
190 | return undefined | 190 | return undefined |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index ec14939c2..6c0db59f3 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -317,7 +317,7 @@ function associate (models) { | |||
317 | }) | 317 | }) |
318 | } | 318 | } |
319 | 319 | ||
320 | function afterDestroy (video: VideoInstance, options: { transaction: Sequelize.Transaction }) { | 320 | function afterDestroy (video: VideoInstance) { |
321 | const tasks = [] | 321 | const tasks = [] |
322 | 322 | ||
323 | tasks.push( | 323 | tasks.push( |
@@ -331,7 +331,7 @@ function afterDestroy (video: VideoInstance, options: { transaction: Sequelize.T | |||
331 | 331 | ||
332 | tasks.push( | 332 | tasks.push( |
333 | video.removePreview(), | 333 | video.removePreview(), |
334 | removeVideoToFriends(removeVideoToFriendsParams, options.transaction) | 334 | removeVideoToFriends(removeVideoToFriendsParams) |
335 | ) | 335 | ) |
336 | 336 | ||
337 | // Remove physical files and torrents | 337 | // Remove physical files and torrents |