aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/shared/actor/actor.model.ts4
-rw-r--r--client/src/app/shared/angular/timestamp-route-transformer.directive.ts5
-rw-r--r--client/src/app/shared/misc/utils.ts5
-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
5 files changed, 16 insertions, 4 deletions
diff --git a/client/src/app/shared/actor/actor.model.ts b/client/src/app/shared/actor/actor.model.ts
index 285f71ce0..9cc51b948 100644
--- a/client/src/app/shared/actor/actor.model.ts
+++ b/client/src/app/shared/actor/actor.model.ts
@@ -20,6 +20,10 @@ export abstract class Actor implements ActorServer {
20 20
21 if (actor && actor.avatar) return absoluteAPIUrl + actor.avatar.path 21 if (actor && actor.avatar) return absoluteAPIUrl + actor.avatar.path
22 22
23 this.GET_DEFAULT_AVATAR_URL()
24 }
25
26 static GET_DEFAULT_AVATAR_URL () {
23 return window.location.origin + '/client/assets/images/default-avatar.png' 27 return window.location.origin + '/client/assets/images/default-avatar.png'
24 } 28 }
25 29
diff --git a/client/src/app/shared/angular/timestamp-route-transformer.directive.ts b/client/src/app/shared/angular/timestamp-route-transformer.directive.ts
index d71077d10..6e17957f8 100644
--- a/client/src/app/shared/angular/timestamp-route-transformer.directive.ts
+++ b/client/src/app/shared/angular/timestamp-route-transformer.directive.ts
@@ -1,9 +1,6 @@
1import { Directive, ElementRef, HostListener, Output, EventEmitter } from '@angular/core' 1import { Directive, ElementRef, HostListener, Output, EventEmitter } from '@angular/core'
2import { Router } from '@angular/router' 2import { Router } from '@angular/router'
3 3import { ElementEvent } from '@app/shared/misc/utils'
4type ElementEvent = Omit<Event, 'target'> & {
5 target: HTMLInputElement
6}
7 4
8@Directive({ 5@Directive({
9 selector: '[timestampRouteTransformer]' 6 selector: '[timestampRouteTransformer]'
diff --git a/client/src/app/shared/misc/utils.ts b/client/src/app/shared/misc/utils.ts
index b1d1fc0b5..096fd61e2 100644
--- a/client/src/app/shared/misc/utils.ts
+++ b/client/src/app/shared/misc/utils.ts
@@ -4,6 +4,10 @@ import { DatePipe } from '@angular/common'
4import { environment } from '../../../environments/environment' 4import { environment } from '../../../environments/environment'
5import { AuthService } from '../../core/auth' 5import { AuthService } from '../../core/auth'
6 6
7type ElementEvent = Omit<Event, 'target'> & {
8 target: HTMLElement
9}
10
7function getParameterByName (name: string, url: string) { 11function getParameterByName (name: string, url: string) {
8 if (!url) url = window.location.href 12 if (!url) url = window.location.href
9 name = name.replace(/[\[\]]/g, '\\$&') 13 name = name.replace(/[\[\]]/g, '\\$&')
@@ -190,6 +194,7 @@ function isXPercentInViewport (el: HTMLElement, percentVisible: number) {
190} 194}
191 195
192export { 196export {
197 ElementEvent,
193 sortBy, 198 sortBy,
194 durationToString, 199 durationToString,
195 lineFeedToHtml, 200 lineFeedToHtml,
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