aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-07 17:14:39 +0200
committerChocobozzz <me@florianbigard.com>2021-05-10 09:38:11 +0200
commite024fd6a7494b37251da1d59470324305cdb4129 (patch)
treee39b8c4b1bd8ba38936f0657e485358fc10b9050 /server/models/video
parent1e0741d16545ea720d04b566a808853b3975ea7f (diff)
downloadPeerTube-e024fd6a7494b37251da1d59470324305cdb4129.tar.gz
PeerTube-e024fd6a7494b37251da1d59470324305cdb4129.tar.zst
PeerTube-e024fd6a7494b37251da1d59470324305cdb4129.zip
Update channel updatedAt when uploading a video
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-channel.ts8
-rw-r--r--server/models/video/video.ts7
2 files changed, 9 insertions, 6 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index b627595c9..081b21f2d 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -1,4 +1,4 @@
1import { FindOptions, Includeable, literal, Op, QueryTypes, ScopeOptions } from 'sequelize' 1import { FindOptions, Includeable, literal, Op, QueryTypes, ScopeOptions, Transaction } from 'sequelize'
2import { 2import {
3 AllowNull, 3 AllowNull,
4 BeforeDestroy, 4 BeforeDestroy,
@@ -17,6 +17,7 @@ import {
17 Table, 17 Table,
18 UpdatedAt 18 UpdatedAt
19} from 'sequelize-typescript' 19} from 'sequelize-typescript'
20import { setAsUpdated } from '@server/helpers/database-utils'
20import { MAccountActor } from '@server/types/models' 21import { MAccountActor } from '@server/types/models'
21import { ActivityPubActor } from '../../../shared/models/activitypub' 22import { ActivityPubActor } from '../../../shared/models/activitypub'
22import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos' 23import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos'
@@ -653,6 +654,7 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"`
653 description: this.description, 654 description: this.description,
654 support: this.support, 655 support: this.support,
655 isLocal: this.Actor.isOwned(), 656 isLocal: this.Actor.isOwned(),
657 updatedAt: this.updatedAt,
656 ownerAccount: undefined, 658 ownerAccount: undefined,
657 videosCount, 659 videosCount,
658 viewsPerDay 660 viewsPerDay
@@ -689,4 +691,8 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"`
689 isOutdated () { 691 isOutdated () {
690 return this.Actor.isOutdated() 692 return this.Actor.isOutdated()
691 } 693 }
694
695 setAsUpdated (transaction: Transaction) {
696 return setAsUpdated('videoChannel', this.id, transaction)
697 }
692} 698}
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index e55a21a6b..8c316e00c 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -24,6 +24,7 @@ import {
24 Table, 24 Table,
25 UpdatedAt 25 UpdatedAt
26} from 'sequelize-typescript' 26} from 'sequelize-typescript'
27import { setAsUpdated } from '@server/helpers/database-utils'
27import { buildNSFWFilter } from '@server/helpers/express-utils' 28import { buildNSFWFilter } from '@server/helpers/express-utils'
28import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video' 29import { getPrivaciesForFederation, isPrivacyForFederation, isStateForFederation } from '@server/helpers/video'
29import { LiveManager } from '@server/lib/live-manager' 30import { LiveManager } from '@server/lib/live-manager'
@@ -2053,11 +2054,7 @@ export class VideoModel extends Model {
2053 } 2054 }
2054 2055
2055 setAsRefreshed () { 2056 setAsRefreshed () {
2056 const options = { 2057 return setAsUpdated('video', this.id)
2057 where: { id: this.id }
2058 }
2059
2060 return VideoModel.update({ updatedAt: new Date() }, options)
2061 } 2058 }
2062 2059
2063 requiresAuth () { 2060 requiresAuth () {