@@ -14,6 +14,7 @@ import { DBSegment, Category, HashedIP, IPAddress, SegmentUUID, Service, VideoID
14
14
import { QueryCacher } from "../utils/queryCacher" ;
15
15
import axios from "axios" ;
16
16
import { getVideoDetails , videoDetails } from "../utils/getVideoDetails" ;
17
+ import { deleteLockCategories } from "./deleteLockCategories" ;
17
18
18
19
const voteTypes = {
19
20
normal : 0 ,
@@ -59,7 +60,7 @@ async function updateSegmentVideoDuration(UUID: SegmentUUID) {
59
60
let apiVideoDetails : videoDetails = null ;
60
61
if ( service == Service . YouTube ) {
61
62
// don't use cache since we have no information about the video length
62
- apiVideoDetails = await getVideoDetails ( videoID ) ;
63
+ apiVideoDetails = await getVideoDetails ( videoID , true ) ;
63
64
}
64
65
const apiVideoDuration = apiVideoDetails ?. duration as VideoDuration ;
65
66
if ( videoDurationChanged ( videoDuration , apiVideoDuration ) ) {
@@ -95,6 +96,7 @@ async function checkVideoDuration(UUID: SegmentUUID) {
95
96
AND "hidden" = 0 AND "shadowHidden" = 0 AND
96
97
"actionType" != 'full' AND "votes" > -2` ,
97
98
[ videoID , service , latestSubmission . timeSubmitted ] ) ;
99
+ deleteLockCategories ( videoID , null , null , service ) . catch ( Logger . error ) ;
98
100
}
99
101
}
100
102
@@ -219,7 +221,7 @@ async function categoryVote(UUID: SegmentUUID, userID: UserID, isVIP: boolean, i
219
221
[ UUID ] , { useReplica : true } ) ) as { category : Category , actionType : ActionType , videoID : VideoID , hashedVideoID : VideoIDHash , service : Service , userID : UserID , locked : number } ;
220
222
221
223
if ( ! config . categorySupport [ category ] ?. includes ( segmentInfo . actionType ) || segmentInfo . actionType === ActionType . Full ) {
222
- return { status : 400 , message : `Not allowed to change to ${ category } when for segment of type ${ segmentInfo . actionType } ` } ;
224
+ return { status : 400 , message : `Not allowed to change to ${ category } when for segment of type ${ segmentInfo . actionType } ` } ;
223
225
}
224
226
if ( ! config . categoryList . includes ( category ) ) {
225
227
return { status : 400 , message : "Category doesn't exist." } ;
0 commit comments