1
0
Fork 0

Fix integrity issues with after destroy hook

This commit is contained in:
Chocobozzz 2017-10-26 14:05:20 +02:00
parent 6cd44728bb
commit 911238e343
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
4 changed files with 9 additions and 9 deletions

View File

@ -86,7 +86,7 @@ function updateVideoToFriends (videoData: RemoteVideoUpdateData, transaction: Se
return createRequest(options) return createRequest(options)
} }
function removeVideoToFriends (videoParams: RemoteVideoRemoveData, transaction: Sequelize.Transaction) { function removeVideoToFriends (videoParams: RemoteVideoRemoveData, transaction?: Sequelize.Transaction) {
const options = { const options = {
type: ENDPOINT_ACTIONS.REMOVE_VIDEO, type: ENDPOINT_ACTIONS.REMOVE_VIDEO,
endpoint: REQUEST_ENDPOINTS.VIDEOS, endpoint: REQUEST_ENDPOINTS.VIDEOS,
@ -106,7 +106,7 @@ function addVideoAuthorToFriends (authorData: RemoteVideoAuthorCreateData, trans
return createRequest(options) return createRequest(options)
} }
function removeVideoAuthorToFriends (authorData: RemoteVideoAuthorRemoveData, transaction: Sequelize.Transaction) { function removeVideoAuthorToFriends (authorData: RemoteVideoAuthorRemoveData, transaction?: Sequelize.Transaction) {
const options = { const options = {
type: ENDPOINT_ACTIONS.REMOVE_AUTHOR, type: ENDPOINT_ACTIONS.REMOVE_AUTHOR,
endpoint: REQUEST_ENDPOINTS.VIDEOS, endpoint: REQUEST_ENDPOINTS.VIDEOS,
@ -136,7 +136,7 @@ function updateVideoChannelToFriends (videoChannelData: RemoteVideoChannelUpdate
return createRequest(options) return createRequest(options)
} }
function removeVideoChannelToFriends (videoChannelParams: RemoteVideoChannelRemoveData, transaction: Sequelize.Transaction) { function removeVideoChannelToFriends (videoChannelParams: RemoteVideoChannelRemoveData, transaction?: Sequelize.Transaction) {
const options = { const options = {
type: ENDPOINT_ACTIONS.REMOVE_CHANNEL, type: ENDPOINT_ACTIONS.REMOVE_CHANNEL,
endpoint: REQUEST_ENDPOINTS.VIDEOS, endpoint: REQUEST_ENDPOINTS.VIDEOS,

View File

@ -107,13 +107,13 @@ function associate (models) {
}) })
} }
function afterDestroy (author: AuthorInstance, options: { transaction: Sequelize.Transaction }) { function afterDestroy (author: AuthorInstance) {
if (author.isOwned()) { if (author.isOwned()) {
const removeVideoAuthorToFriendsParams = { const removeVideoAuthorToFriendsParams = {
uuid: author.uuid uuid: author.uuid
} }
return removeVideoAuthorToFriends(removeVideoAuthorToFriendsParams, options.transaction) return removeVideoAuthorToFriends(removeVideoAuthorToFriendsParams)
} }
return undefined return undefined

View File

@ -178,13 +178,13 @@ function associate (models) {
}) })
} }
function afterDestroy (videoChannel: VideoChannelInstance, options: { transaction: Sequelize.Transaction }) { function afterDestroy (videoChannel: VideoChannelInstance) {
if (videoChannel.isOwned()) { if (videoChannel.isOwned()) {
const removeVideoChannelToFriendsParams = { const removeVideoChannelToFriendsParams = {
uuid: videoChannel.uuid uuid: videoChannel.uuid
} }
return removeVideoChannelToFriends(removeVideoChannelToFriendsParams, options.transaction) return removeVideoChannelToFriends(removeVideoChannelToFriendsParams)
} }
return undefined return undefined

View File

@ -317,7 +317,7 @@ function associate (models) {
}) })
} }
function afterDestroy (video: VideoInstance, options: { transaction: Sequelize.Transaction }) { function afterDestroy (video: VideoInstance) {
const tasks = [] const tasks = []
tasks.push( tasks.push(
@ -331,7 +331,7 @@ function afterDestroy (video: VideoInstance, options: { transaction: Sequelize.T
tasks.push( tasks.push(
video.removePreview(), video.removePreview(),
removeVideoToFriends(removeVideoToFriendsParams, options.transaction) removeVideoToFriends(removeVideoToFriendsParams)
) )
// Remove physical files and torrents // Remove physical files and torrents