import {
MActor,
MActorAccountChannelId,
+ MActorAP,
MActorFormattable,
- MActorFull, MActorHost,
+ MActorFull,
+ MActorHost,
MActorServer,
- MActorSummaryFormattable,
- MServerHost,
- MActorRedundancyAllowed
+ MActorSummaryFormattable
} from '../../typings/models'
import * as Bluebird from 'bluebird'
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
inboxUrl: string
- @AllowNull(false)
- @Is('ActorOutboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'outbox url'))
+ @AllowNull(true)
+ @Is('ActorOutboxUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'outbox url', true))
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
outboxUrl: string
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
sharedInboxUrl: string
- @AllowNull(false)
- @Is('ActorFollowersUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'followers url'))
+ @AllowNull(true)
+ @Is('ActorFollowersUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'followers url', true))
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
followersUrl: string
- @AllowNull(false)
- @Is('ActorFollowingUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'following url'))
+ @AllowNull(true)
+ @Is('ActorFollowingUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'following url', true))
@Column(DataType.STRING(CONSTRAINTS_FIELDS.ACTORS.URL.max))
followingUrl: string
})
}
- toActivityPubObject (name: string, type: 'Account' | 'Application' | 'VideoChannel') {
- let activityPubType
- if (type === 'Account') {
- activityPubType = 'Person' as 'Person'
- } else if (type === 'Application') {
- activityPubType = 'Application' as 'Application'
- } else { // VideoChannel
- activityPubType = 'Group' as 'Group'
- }
-
+ toActivityPubObject (this: MActorAP, name: string) {
let icon = undefined
if (this.avatarId) {
const extension = extname(this.Avatar.filename)
}
const json = {
- type: activityPubType,
+ type: this.type,
id: this.url,
following: this.getFollowingUrl(),
followers: this.getFollowersUrl(),
return this.Server ? this.Server.host : WEBSERVER.HOST
}
- getRedundancyAllowed (this: MActorRedundancyAllowed) {
+ getRedundancyAllowed () {
return this.Server ? this.Server.redundancyAllowed : false
}