From e379f813d45c4a83442aa13268d351e2605a7a01 Mon Sep 17 00:00:00 2001 From: Nassim Bounouas Date: Wed, 19 Jun 2019 14:57:39 +0200 Subject: Feature/completeUsernameCopy (#1913) * #1843 Copy icon added to account page to copy Username * #1843 Store an account name with the host forced and bind it to copy button * #1843 tslint correction * #1843 copy to clipboard replaced by ngx-clipboard --- client/src/app/+accounts/accounts.component.html | 7 +++++-- client/src/app/shared/account/account.model.ts | 2 ++ client/src/app/shared/actor/actor.model.ts | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client/src/app/+accounts/accounts.component.html b/client/src/app/+accounts/accounts.component.html index 038e18c4b..1172f7ba7 100644 --- a/client/src/app/+accounts/accounts.component.html +++ b/client/src/app/+accounts/accounts.component.html @@ -7,8 +7,11 @@
{{ account.displayName }}
-
{{ account.nameWithHost }}
- +
{{ account.nameWithHost }} + +
Banned Muted Muted by your instance diff --git a/client/src/app/shared/account/account.model.ts b/client/src/app/shared/account/account.model.ts index c5cd2051c..61f09fc06 100644 --- a/client/src/app/shared/account/account.model.ts +++ b/client/src/app/shared/account/account.model.ts @@ -5,6 +5,7 @@ export class Account extends Actor implements ServerAccount { displayName: string description: string nameWithHost: string + nameWithHostForced: string mutedByUser: boolean mutedByInstance: boolean mutedServerByUser: boolean @@ -19,6 +20,7 @@ export class Account extends Actor implements ServerAccount { this.description = hash.description this.userId = hash.userId this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host) + this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true) this.mutedByUser = false this.mutedByInstance = false diff --git a/client/src/app/shared/actor/actor.model.ts b/client/src/app/shared/actor/actor.model.ts index 5a517c975..285f71ce0 100644 --- a/client/src/app/shared/actor/actor.model.ts +++ b/client/src/app/shared/actor/actor.model.ts @@ -23,11 +23,11 @@ export abstract class Actor implements ActorServer { return window.location.origin + '/client/assets/images/default-avatar.png' } - static CREATE_BY_STRING (accountName: string, host: string) { + static CREATE_BY_STRING (accountName: string, host: string, forceHostname = false) { const absoluteAPIUrl = getAbsoluteAPIUrl() const thisHost = new URL(absoluteAPIUrl).host - if (host.trim() === thisHost) return accountName + if (host.trim() === thisHost && !forceHostname) return accountName return accountName + '@' + host } -- cgit v1.2.3