diff options
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r-- | client/src/app/shared/shared-main/account/actor.model.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/client/src/app/shared/shared-main/account/actor.model.ts b/client/src/app/shared/shared-main/account/actor.model.ts index bda88bdee..950e256ff 100644 --- a/client/src/app/shared/shared-main/account/actor.model.ts +++ b/client/src/app/shared/shared-main/account/actor.model.ts | |||
@@ -41,6 +41,13 @@ export abstract class Actor implements ActorServer { | |||
41 | return accountName + '@' + host | 41 | return accountName + '@' + host |
42 | } | 42 | } |
43 | 43 | ||
44 | static IS_LOCAL (host: string) { | ||
45 | const absoluteAPIUrl = getAbsoluteAPIUrl() | ||
46 | const thisHost = new URL(absoluteAPIUrl).host | ||
47 | |||
48 | return host.trim() === thisHost | ||
49 | } | ||
50 | |||
44 | protected constructor (hash: ActorServer) { | 51 | protected constructor (hash: ActorServer) { |
45 | this.id = hash.id | 52 | this.id = hash.id |
46 | this.url = hash.url | 53 | this.url = hash.url |
@@ -53,10 +60,7 @@ export abstract class Actor implements ActorServer { | |||
53 | if (hash.updatedAt) this.updatedAt = new Date(hash.updatedAt.toString()) | 60 | if (hash.updatedAt) this.updatedAt = new Date(hash.updatedAt.toString()) |
54 | 61 | ||
55 | this.avatar = hash.avatar | 62 | this.avatar = hash.avatar |
56 | 63 | this.isLocal = Actor.IS_LOCAL(this.host) | |
57 | const absoluteAPIUrl = getAbsoluteAPIUrl() | ||
58 | const thisHost = new URL(absoluteAPIUrl).host | ||
59 | this.isLocal = this.host.trim() === thisHost | ||
60 | 64 | ||
61 | this.updateComputedAttributes() | 65 | this.updateComputedAttributes() |
62 | } | 66 | } |