aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
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/activitypub
parent64df4b65aee56784f8edad917c44b24453bf4658 (diff)
downloadPeerTube-a66c2e3252d6cca8958959966f42494ded564023.tar.gz
PeerTube-a66c2e3252d6cca8958959966f42494ded564023.tar.zst
PeerTube-a66c2e3252d6cca8958959966f42494ded564023.zip
Fix remote actor creation date
Diffstat (limited to 'server/models/activitypub')
-rw-r--r--server/models/activitypub/actor.ts15
1 files changed, 11 insertions, 4 deletions
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}