Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Feature/completeUsernameCopy (#1913)

Nassim Bounouase379f813d45c
diff --git a/client/src/app/+accounts/accounts.component.html b/client/src/app/+accounts/accounts.component.html
index 038e18c4bd..1172f7ba72 100644
--- a/client/src/app/+accounts/accounts.component.html
+++ b/client/src/app/+accounts/accounts.component.html
@@ -7,8 +7,11 @@
<div class="actor-info">
<div class="actor-names">
<div class="actor-display-name">{{ account.displayName }}</div>
- <div class="actor-name">{{ account.nameWithHost }}</div>
-
+ <div class="actor-name">{{ account.nameWithHost }}
+ <button ngxClipboard [cbContent]="account.nameWithHostForced" type="button" class="btn btn-outline-secondary btn-sm">
+ <span class="glyphicon glyphicon-copy"></span>
+ </button>
+ </div>
<span *ngIf="user?.blocked" [ngbTooltip]="user.blockedReason" class="badge badge-danger" i18n>Banned</span>
<span *ngIf="account.mutedByUser" class="badge badge-danger" i18n>Muted</span>
<span *ngIf="account.mutedServerByUser" class="badge badge-danger" i18n>Muted by your instance</span>
diff --git a/client/src/app/shared/account/account.model.ts b/client/src/app/shared/account/account.model.ts
index c5cd2051ca..61f09fc062 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 5a517c975b..285f71ce0d 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
}