aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-07 08:59:59 +0200
committerChocobozzz <me@florianbigard.com>2021-05-07 09:00:09 +0200
commita66c2e3252d6cca8958959966f42494ded564023 (patch)
tree79e32e2255c7787cfbd127581a4b162552068d66 /server/models
parent64df4b65aee56784f8edad917c44b24453bf4658 (diff)
downloadPeerTube-a66c2e3252d6cca8958959966f42494ded564023.tar.gz
PeerTube-a66c2e3252d6cca8958959966f42494ded564023.tar.zst
PeerTube-a66c2e3252d6cca8958959966f42494ded564023.zip
Fix remote actor creation date
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/account.ts2
-rw-r--r--server/models/activitypub/actor.ts15
-rw-r--r--server/models/video/video-channel.ts2
3 files changed, 11 insertions, 8 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 312451abe..44be0fd3c 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -411,8 +411,6 @@ export class AccountModel extends Model {
411 id: this.id, 411 id: this.id,
412 displayName: this.getDisplayName(), 412 displayName: this.getDisplayName(),
413 description: this.description, 413 description: this.description,
414 createdAt: this.createdAt,
415 updatedAt: this.updatedAt,
416 userId: this.userId ? this.userId : undefined 414 userId: this.userId ? this.userId : undefined
417 } 415 }
418 416
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index 19f3f7e04..396a52337 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -69,9 +69,7 @@ export const unusedActorAttributesForAPI = [
69 'outboxUrl', 69 'outboxUrl',
70 'sharedInboxUrl', 70 'sharedInboxUrl',
71 'followersUrl', 71 'followersUrl',
72 'followingUrl', 72 'followingUrl'
73 'createdAt',
74 'updatedAt'
75] 73]
76 74
77@DefaultScope(() => ({ 75@DefaultScope(() => ({
@@ -222,6 +220,10 @@ export class ActorModel extends Model {
222 @Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max)) 220 @Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
223 followingUrl: string 221 followingUrl: string
224 222
223 @AllowNull(true)
224 @Column
225 remoteCreatedAt: Date
226
225 @CreatedAt 227 @CreatedAt
226 createdAt: Date 228 createdAt: Date
227 229
@@ -555,7 +557,7 @@ export class ActorModel extends Model {
555 followingCount: this.followingCount, 557 followingCount: this.followingCount,
556 followersCount: this.followersCount, 558 followersCount: this.followersCount,
557 banner, 559 banner,
558 createdAt: this.createdAt, 560 createdAt: this.getCreatedAt(),
559 updatedAt: this.updatedAt 561 updatedAt: this.updatedAt
560 }) 562 })
561 } 563 }
@@ -608,6 +610,7 @@ export class ActorModel extends Model {
608 owner: this.url, 610 owner: this.url,
609 publicKeyPem: this.publicKey 611 publicKeyPem: this.publicKey
610 }, 612 },
613 published: this.getCreatedAt().toISOString(),
611 icon, 614 icon,
612 image 615 image
613 } 616 }
@@ -690,4 +693,8 @@ export class ActorModel extends Model {
690 693
691 return isOutdated(this, ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL) 694 return isOutdated(this, ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL)
692 } 695 }
696
697 getCreatedAt (this: MActorAPChannel | MActorAPAccount | MActorFormattable) {
698 return this.remoteCreatedAt || this.createdAt
699 }
693} 700}
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index b7ffbd3b1..b627595c9 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -653,8 +653,6 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"`
653 description: this.description, 653 description: this.description,
654 support: this.support, 654 support: this.support,
655 isLocal: this.Actor.isOwned(), 655 isLocal: this.Actor.isOwned(),
656 createdAt: this.createdAt,
657 updatedAt: this.updatedAt,
658 ownerAccount: undefined, 656 ownerAccount: undefined,
659 videosCount, 657 videosCount,
660 viewsPerDay 658 viewsPerDay