diff options
author | Chocobozzz <me@florianbigard.com> | 2019-10-23 11:33:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-10-23 11:33:53 +0200 |
commit | 47581df0737ebcc058a5863143c752f9112a4424 (patch) | |
tree | 3b64e3fc49de4bea41d8fd852201ba3abb6b4994 /server/models/activitypub/actor.ts | |
parent | a0e6d267598839c8a5508a65876ce0e07d1b3d74 (diff) | |
download | PeerTube-47581df0737ebcc058a5863143c752f9112a4424.tar.gz PeerTube-47581df0737ebcc058a5863143c752f9112a4424.tar.zst PeerTube-47581df0737ebcc058a5863143c752f9112a4424.zip |
Fix federation with some actors
That don't have a shared inbox, or a URL
Diffstat (limited to 'server/models/activitypub/actor.ts')
-rw-r--r-- | server/models/activitypub/actor.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index 535ebd792..42a24b583 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts | |||
@@ -44,7 +44,8 @@ import { | |||
44 | MActorFull, | 44 | MActorFull, |
45 | MActorHost, | 45 | MActorHost, |
46 | MActorServer, | 46 | MActorServer, |
47 | MActorSummaryFormattable | 47 | MActorSummaryFormattable, |
48 | MActorWithInboxes | ||
48 | } from '../../typings/models' | 49 | } from '../../typings/models' |
49 | import * as Bluebird from 'bluebird' | 50 | import * as Bluebird from 'bluebird' |
50 | 51 | ||
@@ -179,8 +180,8 @@ export class ActorModel extends Model<ActorModel> { | |||
179 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max)) | 180 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max)) |
180 | outboxUrl: string | 181 | outboxUrl: string |
181 | 182 | ||
182 | @AllowNull(false) | 183 | @AllowNull(true) |
183 | @Is('ActorSharedInboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'shared inbox url')) | 184 | @Is('ActorSharedInboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'shared inbox url', true)) |
184 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max)) | 185 | @Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max)) |
185 | sharedInboxUrl: string | 186 | sharedInboxUrl: string |
186 | 187 | ||
@@ -402,6 +403,10 @@ export class ActorModel extends Model<ActorModel> { | |||
402 | }) | 403 | }) |
403 | } | 404 | } |
404 | 405 | ||
406 | getSharedInbox (this: MActorWithInboxes) { | ||
407 | return this.sharedInboxUrl || this.inboxUrl | ||
408 | } | ||
409 | |||
405 | toFormattedSummaryJSON (this: MActorSummaryFormattable) { | 410 | toFormattedSummaryJSON (this: MActorSummaryFormattable) { |
406 | let avatar: Avatar = null | 411 | let avatar: Avatar = null |
407 | if (this.Avatar) { | 412 | if (this.Avatar) { |