| 27 | FollowingCount int32 `gorm:"default:0;not null"` |
| 28 | StatusesCount int32 `gorm:"default:0;not null"` |
| 29 | LastStatusAt time.Time |
| 30 | Avatar string `gorm:"size:255"` |
| 31 | Header string `gorm:"size:255"` |
| 32 | PublicKey []byte `gorm:"size:16384;type:blob;not null"` |
| 33 | Attributes []*ActorAttribute `gorm:"constraint:OnDelete:CASCADE;"` |
| 34 | InboxURL string `gorm:"size:255;not null;default:''"` |
| 35 | OutboxURL string `gorm:"size:255;not null;default:''"` |
| 36 | SharedInboxURL string `gorm:"size:255;not null;default:''"` |
| 37 | } |
| 38 | |
| 39 | type ActorType string |
| 40 | |
| 41 | func (ActorType) GormDBDataType(db *gorm.DB, field *schema.Field) string { |
| 42 | switch db.Dialector.Name() { |
| 43 | case "mysql", "postgres": |
| 44 | return "enum('Person', 'Application', 'Service', 'Group', 'Organization', 'LocalPerson', 'LocalService')" |
| 45 | case "sqlite": |
| 46 | return "TEXT" |
| 47 | default: |
| 48 | return "" |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | // Inbox returns the actor's inbox URL, or shared inbox URL if applicable. |
| 53 | func (a *Actor) Inbox() string { |
| 54 | if a.SharedInboxURL != "" { |
| 55 | return a.SharedInboxURL |
| 56 | } |
| 57 | return a.InboxURL |
| 58 | } |
| 59 | |
| 60 | func (a *Actor) AfterCreate(tx *gorm.DB) error { |
| 61 | return forEach(tx, a.updateInstanceDomainsCount) |
| 62 | } |
| 63 | |
| 64 | func (a *Actor) AfterUpdate(tx *gorm.DB) error { |
| 65 | return forEach(tx, a.maybeScheduleRefresh) |
| 66 | } |
nothing calls this directly
no outgoing calls
no test coverage detected