aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/activitypub')
-rw-r--r--server/models/activitypub/actor.ts35
1 files changed, 27 insertions, 8 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index 3b98e8841..09d96b24d 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -19,7 +19,7 @@ import {
19} from 'sequelize-typescript' 19} from 'sequelize-typescript'
20import { ModelCache } from '@server/models/model-cache' 20import { ModelCache } from '@server/models/model-cache'
21import { ActivityIconObject, ActivityPubActorType } from '../../../shared/models/activitypub' 21import { ActivityIconObject, ActivityPubActorType } from '../../../shared/models/activitypub'
22import { Avatar } from '../../../shared/models/avatars/avatar.model' 22import { ActorImage } from '../../../shared/models/actors/actor-image.model'
23import { activityPubContextify } from '../../helpers/activitypub' 23import { activityPubContextify } from '../../helpers/activitypub'
24import { 24import {
25 isActorFollowersCountValid, 25 isActorFollowersCountValid,
@@ -43,7 +43,7 @@ import {
43 MActorWithInboxes 43 MActorWithInboxes
44} from '../../types/models' 44} from '../../types/models'
45import { AccountModel } from '../account/account' 45import { AccountModel } from '../account/account'
46import { AvatarModel } from '../avatar/avatar' 46import { ActorImageModel } from '../account/actor-image'
47import { ServerModel } from '../server/server' 47import { ServerModel } from '../server/server'
48import { isOutdated, throwIfNotValid } from '../utils' 48import { isOutdated, throwIfNotValid } from '../utils'
49import { VideoModel } from '../video/video' 49import { VideoModel } from '../video/video'
@@ -73,7 +73,8 @@ export const unusedActorAttributesForAPI = [
73 required: false 73 required: false
74 }, 74 },
75 { 75 {
76 model: AvatarModel, 76 model: ActorImageModel,
77 as: 'Avatar',
77 required: false 78 required: false
78 } 79 }
79 ] 80 ]
@@ -100,7 +101,8 @@ export const unusedActorAttributesForAPI = [
100 required: false 101 required: false
101 }, 102 },
102 { 103 {
103 model: AvatarModel, 104 model: ActorImageModel,
105 as: 'Avatar',
104 required: false 106 required: false
105 } 107 }
106 ] 108 ]
@@ -213,18 +215,35 @@ export class ActorModel extends Model {
213 @UpdatedAt 215 @UpdatedAt
214 updatedAt: Date 216 updatedAt: Date
215 217
216 @ForeignKey(() => AvatarModel) 218 @ForeignKey(() => ActorImageModel)
217 @Column 219 @Column
218 avatarId: number 220 avatarId: number
219 221
220 @BelongsTo(() => AvatarModel, { 222 @ForeignKey(() => ActorImageModel)
223 @Column
224 bannerId: number
225
226 @BelongsTo(() => ActorImageModel, {
227 foreignKey: {
228 name: 'avatarId',
229 allowNull: true
230 },
231 as: 'Avatar',
232 onDelete: 'set null',
233 hooks: true
234 })
235 Avatar: ActorImageModel
236
237 @BelongsTo(() => ActorImageModel, {
221 foreignKey: { 238 foreignKey: {
239 name: 'bannerId',
222 allowNull: true 240 allowNull: true
223 }, 241 },
242 as: 'Banner',
224 onDelete: 'set null', 243 onDelete: 'set null',
225 hooks: true 244 hooks: true
226 }) 245 })
227 Avatar: AvatarModel 246 Banner: ActorImageModel
228 247
229 @HasMany(() => ActorFollowModel, { 248 @HasMany(() => ActorFollowModel, {
230 foreignKey: { 249 foreignKey: {
@@ -496,7 +515,7 @@ export class ActorModel extends Model {
496 } 515 }
497 516
498 toFormattedSummaryJSON (this: MActorSummaryFormattable) { 517 toFormattedSummaryJSON (this: MActorSummaryFormattable) {
499 let avatar: Avatar = null 518 let avatar: ActorImage = null
500 if (this.Avatar) { 519 if (this.Avatar) {
501 avatar = this.Avatar.toFormattedJSON() 520 avatar = this.Avatar.toFormattedJSON()
502 } 521 }