]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/actor/actor.model.ts
Fix default avatar URL
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / actor / actor.model.ts
index 5a517c975b67e614cd11b012462c40a519d999b9..0e5060f67838b64d7ad8c7af24d1a901913f881e 100644 (file)
@@ -20,14 +20,18 @@ export abstract class Actor implements ActorServer {
 
     if (actor && actor.avatar) return absoluteAPIUrl + actor.avatar.path
 
+    return this.GET_DEFAULT_AVATAR_URL()
+  }
+
+  static GET_DEFAULT_AVATAR_URL () {
     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
   }