aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-01-07 15:42:14 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-01-09 09:25:32 +0100
commitc511c3f010c45e08e7736a935bf721527db806c8 (patch)
tree5abc1ddd09b4d5b9b779f6d057fbda58015eab68 /client/src/app/videos
parentfbc77eb648bda9add4634c08dbb6af48c3670b5d (diff)
downloadPeerTube-c511c3f010c45e08e7736a935bf721527db806c8.tar.gz
PeerTube-c511c3f010c45e08e7736a935bf721527db806c8.tar.zst
PeerTube-c511c3f010c45e08e7736a935bf721527db806c8.zip
Show default avatar on network error for comments
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.html1
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.ts5
2 files changed, 6 insertions, 0 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.html b/client/src/app/videos/+video-watch/comment/video-comment.component.html
index 246a08435..617d0fa41 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.component.html
+++ b/client/src/app/videos/+video-watch/comment/video-comment.component.html
@@ -4,6 +4,7 @@
4 <img 4 <img
5 class="comment-avatar" 5 class="comment-avatar"
6 [src]="comment.accountAvatarUrl" 6 [src]="comment.accountAvatarUrl"
7 (error)="switchToDefaultAvatar($event)"
7 alt="Avatar" 8 alt="Avatar"
8 /> 9 />
9 </a> 10 </a>
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.ts b/client/src/app/videos/+video-watch/comment/video-comment.component.ts
index 0c18b6e5d..61f9335d1 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.component.ts
@@ -9,6 +9,7 @@ import { MarkdownService } from '@app/shared/renderer'
9import { Account } from '@app/shared/account/account.model' 9import { Account } from '@app/shared/account/account.model'
10import { Notifier } from '@app/core' 10import { Notifier } from '@app/core'
11import { UserService } from '@app/shared' 11import { UserService } from '@app/shared'
12import { Actor } from '@app/shared/actor/actor.model'
12 13
13@Component({ 14@Component({
14 selector: 'my-video-comment', 15 selector: 'my-video-comment',
@@ -101,6 +102,10 @@ export class VideoCommentComponent implements OnInit, OnChanges {
101 ) 102 )
102 } 103 }
103 104
105 switchToDefaultAvatar ($event: Event) {
106 ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL()
107 }
108
104 private getUserIfNeeded (account: Account) { 109 private getUserIfNeeded (account: Account) {
105 if (!account.userId) return 110 if (!account.userId) return
106 if (!this.authService.isLoggedIn()) return 111 if (!this.authService.isLoggedIn()) return