1 import { Account as ServerAccount, Actor as ServerActor, ActorImage } from '@shared/models'
2 import { Actor } from './actor.model'
4 export class Account extends Actor implements ServerAccount {
8 nameWithHostForced: string
10 mutedByInstance: boolean
11 mutedServerByUser: boolean
12 mutedServerByInstance: boolean
16 static GET_ACTOR_AVATAR_URL (actor: { avatar?: { url?: string, path: string } }) {
17 return Actor.GET_ACTOR_AVATAR_URL(actor)
20 static GET_DEFAULT_AVATAR_URL () {
21 return `${window.location.origin}/client/assets/images/default-avatar-account.png`
24 constructor (hash: ServerAccount) {
27 this.displayName = hash.displayName
28 this.description = hash.description
29 this.userId = hash.userId
30 this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host)
31 this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true)
33 this.mutedByUser = false
34 this.mutedByInstance = false
35 this.mutedServerByUser = false
36 this.mutedServerByInstance = false
39 updateAvatar (newAvatar: ActorImage) {
40 this.avatar = newAvatar