aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-10 17:18:12 +0100
committerChocobozzz <me@florianbigard.com>2018-01-10 17:19:14 +0100
commit2ccaeeb341ffe8c2609039bf4c6d8835b4650316 (patch)
treea6bf6e05e7f02bc315e872d67a0b61ad6ad3d777 /server/models/video/video.ts
parent759f8a29e95932023564ca98dcbc90d1acb92da0 (diff)
downloadPeerTube-2ccaeeb341ffe8c2609039bf4c6d8835b4650316.tar.gz
PeerTube-2ccaeeb341ffe8c2609039bf4c6d8835b4650316.tar.zst
PeerTube-2ccaeeb341ffe8c2609039bf4c6d8835b4650316.zip
Fetch remote AP objects
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 918892938..6b825bf93 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -178,6 +178,10 @@ enum ScopeNames {
178 }, 178 },
179 { 179 {
180 fields: [ 'id', 'privacy' ] 180 fields: [ 'id', 'privacy' ]
181 },
182 {
183 fields: [ 'url'],
184 unique: true
181 } 185 }
182 ] 186 ]
183}) 187})
@@ -535,7 +539,7 @@ export class VideoModel extends Model<VideoModel> {
535 return VideoModel.scope([ ScopeNames.WITH_ACCOUNT_DETAILS, ScopeNames.WITH_FILES ]).findOne(query) 539 return VideoModel.scope([ ScopeNames.WITH_ACCOUNT_DETAILS, ScopeNames.WITH_FILES ]).findOne(query)
536 } 540 }
537 541
538 static loadByUUIDOrURL (uuid: string, url: string, t?: Sequelize.Transaction) { 542 static loadByUUIDOrURLAndPopulateAccount (uuid: string, url: string, t?: Sequelize.Transaction) {
539 const query: IFindOptions<VideoModel> = { 543 const query: IFindOptions<VideoModel> = {
540 where: { 544 where: {
541 [Sequelize.Op.or]: [ 545 [Sequelize.Op.or]: [
@@ -547,7 +551,7 @@ export class VideoModel extends Model<VideoModel> {
547 551
548 if (t !== undefined) query.transaction = t 552 if (t !== undefined) query.transaction = t
549 553
550 return VideoModel.scope(ScopeNames.WITH_FILES).findOne(query) 554 return VideoModel.scope([ ScopeNames.WITH_ACCOUNT_DETAILS, ScopeNames.WITH_FILES ]).findOne(query)
551 } 555 }
552 556
553 static loadAndPopulateAccountAndServerAndTags (id: number) { 557 static loadAndPopulateAccountAndServerAndTags (id: number) {
@@ -983,6 +987,10 @@ export class VideoModel extends Model<VideoModel> {
983 { 987 {
984 type: 'Group', 988 type: 'Group',
985 id: this.VideoChannel.Actor.url 989 id: this.VideoChannel.Actor.url
990 },
991 {
992 type: 'Person',
993 id: this.VideoChannel.Account.Actor.url
986 } 994 }
987 ] 995 ]
988 } 996 }