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 {
13 followingCount: number
14 followersCount: number
19 static GET_ACCOUNT_AVATAR_URL (account: Account) {
20 const absoluteAPIUrl = getAbsoluteAPIUrl()
22 if (account && account.avatar) return absoluteAPIUrl + account.avatar.path
24 return window.location.origin + '/client/assets/images/default-avatar.png'
27 static CREATE_BY_STRING (accountName: string, host: string) {
28 const absoluteAPIUrl = getAbsoluteAPIUrl()
29 const thisHost = new URL(absoluteAPIUrl).host
31 if (host.trim() === thisHost) return accountName
33 return accountName + '@' + host