} from 'sequelize-typescript'
import * as Sequelize from 'sequelize'
import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
-import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getSort, throwIfNotValid } from '../utils'
+import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getSort, isOutdated, throwIfNotValid } from '../utils'
import {
isVideoPlaylistDescriptionValid,
isVideoPlaylistNameValid,
} from '../../helpers/custom-validators/video-playlists'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import {
+ ACTIVITY_PUB,
CONFIG,
CONSTRAINTS_FIELDS,
STATIC_PATHS,
})
}
- static listUrlsOfForAP (accountId: number, start: number, count: number) {
+ static listPublicUrlsOfForAP (accountId: number, start: number, count: number) {
const query = {
attributes: [ 'url' ],
offset: start,
limit: count,
where: {
- ownerAccountId: accountId
+ ownerAccountId: accountId,
+ privacy: VideoPlaylistPrivacy.PUBLIC
}
}
.catch(err => logger.warn('Cannot delete thumbnail %s.', thumbnailPath, { err }))
}
+ setAsRefreshed () {
+ this.changed('updatedAt', true)
+
+ return this.save()
+ }
+
isOwned () {
return this.OwnerAccount.isOwned()
}
+ isOutdated () {
+ if (this.isOwned()) return false
+
+ return isOutdated(this, ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL)
+ }
+
toFormattedJSON (): VideoPlaylist {
return {
id: this.id,