1 import { Account as ServerAccount } from '../../../../../shared/models/actors/account.model'
2 import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
3 import { getAbsoluteAPIUrl } from '../misc/utils'
5 export class Account implements ServerAccount {
12 followingCount: number
13 followersCount: number
18 static GET_ACCOUNT_AVATAR_URL (account: Account) {
19 const absoluteAPIUrl = getAbsoluteAPIUrl()
21 if (account && account.avatar) return absoluteAPIUrl + account.avatar.path
23 return window.location.origin + '/client/assets/images/default-avatar.png'
26 static CREATE_BY_STRING (accountName: string, host: string) {
27 const absoluteAPIUrl = getAbsoluteAPIUrl()
28 const thisHost = new URL(absoluteAPIUrl).host
30 if (host.trim() === thisHost) return accountName
32 return accountName + '@' + host