diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-19 14:13:53 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-03-19 14:13:53 +0100 |
commit | 9f79ade627f0044606a9fbbe16ca0154661d12b9 (patch) | |
tree | ccfc1876da591bc52cbb4b8ccddedbeae7876679 /server/models/video/video-playlist.ts | |
parent | 0e0c745b62b2f18e228328e8c4f95b17e54f7a5e (diff) | |
download | PeerTube-9f79ade627f0044606a9fbbe16ca0154661d12b9.tar.gz PeerTube-9f79ade627f0044606a9fbbe16ca0154661d12b9.tar.zst PeerTube-9f79ade627f0044606a9fbbe16ca0154661d12b9.zip |
Refresh playlists
Diffstat (limited to 'server/models/video/video-playlist.ts')
-rw-r--r-- | server/models/video/video-playlist.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts index 7dbe4ce8d..08e4d32c8 100644 --- a/server/models/video/video-playlist.ts +++ b/server/models/video/video-playlist.ts | |||
@@ -17,7 +17,7 @@ import { | |||
17 | } from 'sequelize-typescript' | 17 | } from 'sequelize-typescript' |
18 | import * as Sequelize from 'sequelize' | 18 | import * as Sequelize from 'sequelize' |
19 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' | 19 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' |
20 | import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getSort, throwIfNotValid } from '../utils' | 20 | import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getSort, isOutdated, throwIfNotValid } from '../utils' |
21 | import { | 21 | import { |
22 | isVideoPlaylistDescriptionValid, | 22 | isVideoPlaylistDescriptionValid, |
23 | isVideoPlaylistNameValid, | 23 | isVideoPlaylistNameValid, |
@@ -25,6 +25,7 @@ import { | |||
25 | } from '../../helpers/custom-validators/video-playlists' | 25 | } from '../../helpers/custom-validators/video-playlists' |
26 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' | 26 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' |
27 | import { | 27 | import { |
28 | ACTIVITY_PUB, | ||
28 | CONFIG, | 29 | CONFIG, |
29 | CONSTRAINTS_FIELDS, | 30 | CONSTRAINTS_FIELDS, |
30 | STATIC_PATHS, | 31 | STATIC_PATHS, |
@@ -429,10 +430,22 @@ export class VideoPlaylistModel extends Model<VideoPlaylistModel> { | |||
429 | .catch(err => logger.warn('Cannot delete thumbnail %s.', thumbnailPath, { err })) | 430 | .catch(err => logger.warn('Cannot delete thumbnail %s.', thumbnailPath, { err })) |
430 | } | 431 | } |
431 | 432 | ||
433 | setAsRefreshed () { | ||
434 | this.changed('updatedAt', true) | ||
435 | |||
436 | return this.save() | ||
437 | } | ||
438 | |||
432 | isOwned () { | 439 | isOwned () { |
433 | return this.OwnerAccount.isOwned() | 440 | return this.OwnerAccount.isOwned() |
434 | } | 441 | } |
435 | 442 | ||
443 | isOutdated () { | ||
444 | if (this.isOwned()) return false | ||
445 | |||
446 | return isOutdated(this, ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL) | ||
447 | } | ||
448 | |||
436 | toFormattedJSON (): VideoPlaylist { | 449 | toFormattedJSON (): VideoPlaylist { |
437 | return { | 450 | return { |
438 | id: this.id, | 451 | id: this.id, |