]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/shared-main/account/account.model.ts
Sort channels by -updatedAt
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / account / account.model.ts
CommitLineData
126a6352 1import { Account as ServerAccount, Actor as ServerActor, ActorImage } from '@shared/models'
67ed6552 2import { Actor } from './actor.model'
b1fa3eba 3
d3e91a5f 4export class Account extends Actor implements ServerAccount {
c5911fd3 5 displayName: string
2422c46b 6 description: string
dc2b2938
C
7
8 updatedAt: Date | string
9
ad9e39fb 10 nameWithHost: string
e379f813 11 nameWithHostForced: string
dc2b2938 12
65b21c96
C
13 mutedByUser: boolean
14 mutedByInstance: boolean
15 mutedServerByUser: boolean
16 mutedServerByInstance: boolean
6b738c7a 17
79bd2632
C
18 userId?: number
19
126a6352 20 static GET_ACTOR_AVATAR_URL (actor: { avatar?: { url?: string, path: string } }) {
09790754 21 return Actor.GET_ACTOR_AVATAR_URL(actor)
c418d483 22 }
23
24 static GET_DEFAULT_AVATAR_URL () {
25 return `${window.location.origin}/client/assets/images/default-avatar-account.png`
26 }
27
6b738c7a 28 constructor (hash: ServerAccount) {
d3e91a5f
C
29 super(hash)
30
6b738c7a
C
31 this.displayName = hash.displayName
32 this.description = hash.description
79bd2632 33 this.userId = hash.userId
ad9e39fb 34 this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host)
e379f813 35 this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true)
af5767ff 36
dc2b2938
C
37 if (hash.updatedAt) this.updatedAt = new Date(hash.updatedAt.toString())
38
65b21c96
C
39 this.mutedByUser = false
40 this.mutedByInstance = false
41 this.mutedServerByUser = false
42 this.mutedServerByInstance = false
6b738c7a 43 }
c418d483 44
f4796856 45 updateAvatar (newAvatar: ActorImage) {
c418d483 46 this.avatar = newAvatar
c418d483 47 }
48
1ea7da81
RK
49 resetAvatar () {
50 this.avatar = null
c418d483 51 }
b1fa3eba 52}