diff options
author | kimsible <kimsible@users.noreply.github.com> | 2020-11-18 19:20:05 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-25 11:12:06 +0100 |
commit | c418d483004dfbae9ea38d54aa1577db46d34a8a (patch) | |
tree | c4fd4ec790c6e5d6bc44e887090a8286e10fffd2 | |
parent | 18490b07650d77d7fe376970b749af5a8c672fd6 (diff) | |
download | PeerTube-c418d483004dfbae9ea38d54aa1577db46d34a8a.tar.gz PeerTube-c418d483004dfbae9ea38d54aa1577db46d34a8a.tar.zst PeerTube-c418d483004dfbae9ea38d54aa1577db46d34a8a.zip |
Add new default different avatar for channel and account
18 files changed, 77 insertions, 51 deletions
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 9f92358a0..7875b74ad 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -2,7 +2,7 @@ import { SortMeta } from 'primeng/api' | |||
2 | import { Component, OnInit, ViewChild } from '@angular/core' | 2 | import { Component, OnInit, ViewChild } from '@angular/core' |
3 | import { ActivatedRoute, Params, Router } from '@angular/router' | 3 | import { ActivatedRoute, Params, Router } from '@angular/router' |
4 | import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' | 4 | import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' |
5 | import { Actor, DropdownAction } from '@app/shared/shared-main' | 5 | import { Account, DropdownAction } from '@app/shared/shared-main' |
6 | import { UserBanModalComponent } from '@app/shared/shared-moderation' | 6 | import { UserBanModalComponent } from '@app/shared/shared-moderation' |
7 | import { ServerConfig, User, UserRole } from '@shared/models' | 7 | import { ServerConfig, User, UserRole } from '@shared/models' |
8 | 8 | ||
@@ -164,7 +164,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
164 | } | 164 | } |
165 | 165 | ||
166 | switchToDefaultAvatar ($event: Event) { | 166 | switchToDefaultAvatar ($event: Event) { |
167 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | 167 | ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL() |
168 | } | 168 | } |
169 | 169 | ||
170 | async unbanUsers (users: User[]) { | 170 | async unbanUsers (users: User[]) { |
diff --git a/client/src/app/+my-library/my-ownership/my-ownership.component.ts b/client/src/app/+my-library/my-ownership/my-ownership.component.ts index e1aca65f6..78c3d9192 100644 --- a/client/src/app/+my-library/my-ownership/my-ownership.component.ts +++ b/client/src/app/+my-library/my-ownership/my-ownership.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Component, OnInit, ViewChild } from '@angular/core' | 2 | import { Component, OnInit, ViewChild } from '@angular/core' |
3 | import { Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { Account, Actor, VideoOwnershipService } from '@app/shared/shared-main' | 4 | import { Account, VideoOwnershipService } from '@app/shared/shared-main' |
5 | import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '@shared/models' | 5 | import { VideoChangeOwnership, VideoChangeOwnershipStatus } from '@shared/models' |
6 | import { MyAcceptOwnershipComponent } from './my-accept-ownership/my-accept-ownership.component' | 6 | import { MyAcceptOwnershipComponent } from './my-accept-ownership/my-accept-ownership.component' |
7 | 7 | ||
@@ -44,7 +44,7 @@ export class MyOwnershipComponent extends RestTable implements OnInit { | |||
44 | } | 44 | } |
45 | 45 | ||
46 | switchToDefaultAvatar ($event: Event) { | 46 | switchToDefaultAvatar ($event: Event) { |
47 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | 47 | ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL() |
48 | } | 48 | } |
49 | 49 | ||
50 | openAcceptModal (videoChangeOwnership: VideoChangeOwnership) { | 50 | openAcceptModal (videoChangeOwnership: VideoChangeOwnership) { |
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts index 4bde5c53d..f1f0dfeba 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment-add.component.ts | |||
@@ -4,7 +4,7 @@ import { Router } from '@angular/router' | |||
4 | import { Notifier, User } from '@app/core' | 4 | import { Notifier, User } from '@app/core' |
5 | import { VIDEO_COMMENT_TEXT_VALIDATOR } from '@app/shared/form-validators/video-comment-validators' | 5 | import { VIDEO_COMMENT_TEXT_VALIDATOR } from '@app/shared/form-validators/video-comment-validators' |
6 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 6 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
7 | import { Video } from '@app/shared/shared-main' | 7 | import { Video, Account } from '@app/shared/shared-main' |
8 | import { VideoComment, VideoCommentService } from '@app/shared/shared-video-comment' | 8 | import { VideoComment, VideoCommentService } from '@app/shared/shared-video-comment' |
9 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 9 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
10 | import { VideoCommentCreate } from '@shared/models' | 10 | import { VideoCommentCreate } from '@shared/models' |
@@ -145,7 +145,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
145 | 145 | ||
146 | getAvatarUrl () { | 146 | getAvatarUrl () { |
147 | if (this.user) return this.user.accountAvatarUrl | 147 | if (this.user) return this.user.accountAvatarUrl |
148 | return window.location.origin + '/client/assets/images/default-avatar.png' | 148 | return Account.GET_DEFAULT_AVATAR_URL() |
149 | } | 149 | } |
150 | 150 | ||
151 | gotoLogin () { | 151 | gotoLogin () { |
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 3b3a5cc81..0958b25c0 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 | |||
@@ -2,7 +2,7 @@ | |||
2 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core' | 2 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core' |
3 | import { MarkdownService, Notifier, UserService } from '@app/core' | 3 | import { MarkdownService, Notifier, UserService } from '@app/core' |
4 | import { AuthService } from '@app/core/auth' | 4 | import { AuthService } from '@app/core/auth' |
5 | import { Account, Actor, DropdownAction, Video } from '@app/shared/shared-main' | 5 | import { Account, DropdownAction, Video } from '@app/shared/shared-main' |
6 | import { CommentReportComponent } from '@app/shared/shared-moderation/report-modals/comment-report.component' | 6 | import { CommentReportComponent } from '@app/shared/shared-moderation/report-modals/comment-report.component' |
7 | import { VideoComment, VideoCommentThreadTree } from '@app/shared/shared-video-comment' | 7 | import { VideoComment, VideoCommentThreadTree } from '@app/shared/shared-video-comment' |
8 | import { User, UserRight } from '@shared/models' | 8 | import { User, UserRight } from '@shared/models' |
@@ -130,7 +130,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
130 | } | 130 | } |
131 | 131 | ||
132 | switchToDefaultAvatar ($event: Event) { | 132 | switchToDefaultAvatar ($event: Event) { |
133 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | 133 | ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL() |
134 | } | 134 | } |
135 | 135 | ||
136 | isNotDeletedOrDeletedWithReplies () { | 136 | isNotDeletedOrDeletedWithReplies () { |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts index 282a6fe19..31cf3389d 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { durationToString } from '@app/helpers' | 2 | import { durationToString } from '@app/helpers' |
3 | import { Actor } from '@app/shared/shared-main' | 3 | import { Account } from '@app/shared/shared-main' |
4 | import { AbusePredefinedReasonsString } from '@shared/models' | 4 | import { AbusePredefinedReasonsString } from '@shared/models' |
5 | import { ProcessedAbuse } from './processed-abuse.model' | 5 | import { ProcessedAbuse } from './processed-abuse.model' |
6 | 6 | ||
@@ -47,6 +47,6 @@ export class AbuseDetailsComponent { | |||
47 | } | 47 | } |
48 | 48 | ||
49 | switchToDefaultAvatar ($event: Event) { | 49 | switchToDefaultAvatar ($event: Event) { |
50 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | 50 | ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL() |
51 | } | 51 | } |
52 | } | 52 | } |
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts index 807665b9c..904f62b57 100644 --- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts +++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts | |||
@@ -122,7 +122,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit, AfterV | |||
122 | } | 122 | } |
123 | 123 | ||
124 | switchToDefaultAvatar ($event: Event) { | 124 | switchToDefaultAvatar ($event: Event) { |
125 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | 125 | ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL() |
126 | } | 126 | } |
127 | 127 | ||
128 | async removeAbuse (abuse: AdminAbuse) { | 128 | async removeAbuse (abuse: AdminAbuse) { |
diff --git a/client/src/app/shared/shared-forms/select/select-channel.component.ts b/client/src/app/shared/shared-forms/select/select-channel.component.ts index 1b0db9b6f..1d91d59bc 100644 --- a/client/src/app/shared/shared-forms/select/select-channel.component.ts +++ b/client/src/app/shared/shared-forms/select/select-channel.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, forwardRef, Input } from '@angular/core' | 1 | import { Component, forwardRef, Input } from '@angular/core' |
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | 2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
3 | import { Actor } from '@app/shared/shared-main/account/actor.model' | 3 | import { VideoChannel } from '@app/shared/shared-main' |
4 | 4 | ||
5 | export type SelectChannelItem = { | 5 | export type SelectChannelItem = { |
6 | id: number | 6 | id: number |
@@ -34,7 +34,7 @@ export class SelectChannelComponent implements ControlValueAccessor { | |||
34 | 34 | ||
35 | get channels () { | 35 | get channels () { |
36 | return this.items.map(c => Object.assign(c, { | 36 | return this.items.map(c => Object.assign(c, { |
37 | avatarPath: c.avatarPath ? c.avatarPath : Actor.GET_DEFAULT_AVATAR_URL() | 37 | avatarPath: c.avatarPath ? c.avatarPath : VideoChannel.GET_DEFAULT_AVATAR_URL() |
38 | })) | 38 | })) |
39 | } | 39 | } |
40 | 40 | ||
diff --git a/client/src/app/shared/shared-main/account/account.model.ts b/client/src/app/shared/shared-main/account/account.model.ts index 6df2e9d10..b3dc6cfe5 100644 --- a/client/src/app/shared/shared-main/account/account.model.ts +++ b/client/src/app/shared/shared-main/account/account.model.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Account as ServerAccount } from '@shared/models/actors/account.model' | 1 | import { Account as ServerAccount, Avatar } from '@shared/models' |
2 | import { Actor } from './actor.model' | 2 | import { Actor } from './actor.model' |
3 | 3 | ||
4 | export class Account extends Actor implements ServerAccount { | 4 | export class Account extends Actor implements ServerAccount { |
@@ -13,9 +13,19 @@ export class Account extends Actor implements ServerAccount { | |||
13 | 13 | ||
14 | userId?: number | 14 | userId?: number |
15 | 15 | ||
16 | static GET_ACTOR_AVATAR_URL (actor: object) { | ||
17 | return Actor.GET_ACTOR_AVATAR_URL(actor) || this.GET_DEFAULT_AVATAR_URL() | ||
18 | } | ||
19 | |||
20 | static GET_DEFAULT_AVATAR_URL () { | ||
21 | return `${window.location.origin}/client/assets/images/default-avatar-account.png` | ||
22 | } | ||
23 | |||
16 | constructor (hash: ServerAccount) { | 24 | constructor (hash: ServerAccount) { |
17 | super(hash) | 25 | super(hash) |
18 | 26 | ||
27 | this.updateComputedAttributes() | ||
28 | |||
19 | this.displayName = hash.displayName | 29 | this.displayName = hash.displayName |
20 | this.description = hash.description | 30 | this.description = hash.description |
21 | this.userId = hash.userId | 31 | this.userId = hash.userId |
@@ -27,4 +37,14 @@ export class Account extends Actor implements ServerAccount { | |||
27 | this.mutedServerByUser = false | 37 | this.mutedServerByUser = false |
28 | this.mutedServerByInstance = false | 38 | this.mutedServerByInstance = false |
29 | } | 39 | } |
40 | |||
41 | updateAvatar (newAvatar: Avatar) { | ||
42 | this.avatar = newAvatar | ||
43 | |||
44 | this.updateComputedAttributes() | ||
45 | } | ||
46 | |||
47 | private updateComputedAttributes () { | ||
48 | this.avatarUrl = Account.GET_ACTOR_AVATAR_URL(this) | ||
49 | } | ||
30 | } | 50 | } |
diff --git a/client/src/app/shared/shared-main/account/actor.model.ts b/client/src/app/shared/shared-main/account/actor.model.ts index 950e256ff..8222c9769 100644 --- a/client/src/app/shared/shared-main/account/actor.model.ts +++ b/client/src/app/shared/shared-main/account/actor.model.ts | |||
@@ -24,12 +24,6 @@ export abstract class Actor implements ActorServer { | |||
24 | 24 | ||
25 | return absoluteAPIUrl + actor.avatar.path | 25 | return absoluteAPIUrl + actor.avatar.path |
26 | } | 26 | } |
27 | |||
28 | return this.GET_DEFAULT_AVATAR_URL() | ||
29 | } | ||
30 | |||
31 | static GET_DEFAULT_AVATAR_URL () { | ||
32 | return window.location.origin + '/client/assets/images/default-avatar.png' | ||
33 | } | 27 | } |
34 | 28 | ||
35 | static CREATE_BY_STRING (accountName: string, host: string, forceHostname = false) { | 29 | static CREATE_BY_STRING (accountName: string, host: string, forceHostname = false) { |
@@ -61,17 +55,5 @@ export abstract class Actor implements ActorServer { | |||
61 | 55 | ||
62 | this.avatar = hash.avatar | 56 | this.avatar = hash.avatar |
63 | this.isLocal = Actor.IS_LOCAL(this.host) | 57 | this.isLocal = Actor.IS_LOCAL(this.host) |
64 | |||
65 | this.updateComputedAttributes() | ||
66 | } | ||
67 | |||
68 | updateAvatar (newAvatar: Avatar) { | ||
69 | this.avatar = newAvatar | ||
70 | |||
71 | this.updateComputedAttributes() | ||
72 | } | ||
73 | |||
74 | private updateComputedAttributes () { | ||
75 | this.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(this) | ||
76 | } | 58 | } |
77 | } | 59 | } |
diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts index 648bb7fe0..b1df4a584 100644 --- a/client/src/app/shared/shared-main/users/user-notification.model.ts +++ b/client/src/app/shared/shared-main/users/user-notification.model.ts | |||
@@ -7,7 +7,7 @@ import { | |||
7 | VideoInfo, | 7 | VideoInfo, |
8 | UserRight | 8 | UserRight |
9 | } from '@shared/models' | 9 | } from '@shared/models' |
10 | import { Actor } from '../account/actor.model' | 10 | import { Account, Actor, VideoChannel } from '@app/shared/shared-main' |
11 | import { AuthUser } from '@app/core' | 11 | import { AuthUser } from '@app/core' |
12 | 12 | ||
13 | export class UserNotification implements UserNotificationServer { | 13 | export class UserNotification implements UserNotificationServer { |
@@ -95,22 +95,22 @@ export class UserNotification implements UserNotificationServer { | |||
95 | // To prevent a notification popup crash in case of bug, wrap it inside a try/catch | 95 | // To prevent a notification popup crash in case of bug, wrap it inside a try/catch |
96 | try { | 96 | try { |
97 | this.video = hash.video | 97 | this.video = hash.video |
98 | if (this.video) this.setAvatarUrl(this.video.channel) | 98 | if (this.video) this.setVideoChannelAvatarUrl(this.video.channel) |
99 | 99 | ||
100 | this.videoImport = hash.videoImport | 100 | this.videoImport = hash.videoImport |
101 | 101 | ||
102 | this.comment = hash.comment | 102 | this.comment = hash.comment |
103 | if (this.comment) this.setAvatarUrl(this.comment.account) | 103 | if (this.comment) this.setAccountAvatarUrl(this.comment.account) |
104 | 104 | ||
105 | this.abuse = hash.abuse | 105 | this.abuse = hash.abuse |
106 | 106 | ||
107 | this.videoBlacklist = hash.videoBlacklist | 107 | this.videoBlacklist = hash.videoBlacklist |
108 | 108 | ||
109 | this.account = hash.account | 109 | this.account = hash.account |
110 | if (this.account) this.setAvatarUrl(this.account) | 110 | if (this.account) this.setAccountAvatarUrl(this.account) |
111 | 111 | ||
112 | this.actorFollow = hash.actorFollow | 112 | this.actorFollow = hash.actorFollow |
113 | if (this.actorFollow) this.setAvatarUrl(this.actorFollow.follower) | 113 | if (this.actorFollow) this.setAccountAvatarUrl(this.actorFollow.follower) |
114 | 114 | ||
115 | this.createdAt = hash.createdAt | 115 | this.createdAt = hash.createdAt |
116 | this.updatedAt = hash.updatedAt | 116 | this.updatedAt = hash.updatedAt |
@@ -222,7 +222,11 @@ export class UserNotification implements UserNotificationServer { | |||
222 | return [ this.buildVideoUrl(comment.video), { threadId: comment.threadId } ] | 222 | return [ this.buildVideoUrl(comment.video), { threadId: comment.threadId } ] |
223 | } | 223 | } |
224 | 224 | ||
225 | private setAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { | 225 | private setAccountAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { |
226 | actor.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(actor) | 226 | actor.avatarUrl = Account.GET_ACTOR_AVATAR_URL(actor) |
227 | } | ||
228 | |||
229 | private setVideoChannelAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { | ||
230 | actor.avatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(actor) | ||
227 | } | 231 | } |
228 | } | 232 | } |
diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts index 123389afb..4f1f5b65d 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.model.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.model.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { VideoChannel as ServerVideoChannel, ViewsPerDate, Account } from '@shared/models' | 1 | import { VideoChannel as ServerVideoChannel, ViewsPerDate, Account, Avatar } from '@shared/models' |
2 | import { Actor } from '../account/actor.model' | 2 | import { Actor } from '../account/actor.model' |
3 | 3 | ||
4 | export class VideoChannel extends Actor implements ServerVideoChannel { | 4 | export class VideoChannel extends Actor implements ServerVideoChannel { |
@@ -17,9 +17,19 @@ export class VideoChannel extends Actor implements ServerVideoChannel { | |||
17 | 17 | ||
18 | viewsPerDay?: ViewsPerDate[] | 18 | viewsPerDay?: ViewsPerDate[] |
19 | 19 | ||
20 | static GET_ACTOR_AVATAR_URL (actor: object) { | ||
21 | return Actor.GET_ACTOR_AVATAR_URL(actor) || this.GET_DEFAULT_AVATAR_URL() | ||
22 | } | ||
23 | |||
24 | static GET_DEFAULT_AVATAR_URL () { | ||
25 | return `${window.location.origin}/client/assets/images/default-avatar-videochannel.png` | ||
26 | } | ||
27 | |||
20 | constructor (hash: ServerVideoChannel) { | 28 | constructor (hash: ServerVideoChannel) { |
21 | super(hash) | 29 | super(hash) |
22 | 30 | ||
31 | this.updateComputedAttributes() | ||
32 | |||
23 | this.displayName = hash.displayName | 33 | this.displayName = hash.displayName |
24 | this.description = hash.description | 34 | this.description = hash.description |
25 | this.support = hash.support | 35 | this.support = hash.support |
@@ -39,4 +49,14 @@ export class VideoChannel extends Actor implements ServerVideoChannel { | |||
39 | this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount) | 49 | this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount) |
40 | } | 50 | } |
41 | } | 51 | } |
52 | |||
53 | updateAvatar (newAvatar: Avatar) { | ||
54 | this.avatar = newAvatar | ||
55 | |||
56 | this.updateComputedAttributes() | ||
57 | } | ||
58 | |||
59 | private updateComputedAttributes () { | ||
60 | this.avatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(this) | ||
61 | } | ||
42 | } | 62 | } |
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index 92f5bc0c0..8e0e68020 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts | |||
@@ -12,7 +12,7 @@ import { | |||
12 | VideoScheduleUpdate, | 12 | VideoScheduleUpdate, |
13 | VideoState | 13 | VideoState |
14 | } from '@shared/models' | 14 | } from '@shared/models' |
15 | import { Actor } from '../account/actor.model' | 15 | import { Account, Actor, VideoChannel } from '@app/shared/shared-main' |
16 | 16 | ||
17 | export class Video implements VideoServerModel { | 17 | export class Video implements VideoServerModel { |
18 | byVideoChannel: string | 18 | byVideoChannel: string |
@@ -142,8 +142,8 @@ export class Video implements VideoServerModel { | |||
142 | 142 | ||
143 | this.byAccount = Actor.CREATE_BY_STRING(hash.account.name, hash.account.host) | 143 | this.byAccount = Actor.CREATE_BY_STRING(hash.account.name, hash.account.host) |
144 | this.byVideoChannel = Actor.CREATE_BY_STRING(hash.channel.name, hash.channel.host) | 144 | this.byVideoChannel = Actor.CREATE_BY_STRING(hash.channel.name, hash.channel.host) |
145 | this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account) | 145 | this.accountAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.account) |
146 | this.videoChannelAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.channel) | 146 | this.videoChannelAvatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(this.channel) |
147 | 147 | ||
148 | this.category.label = peertubeTranslate(this.category.label, translations) | 148 | this.category.label = peertubeTranslate(this.category.label, translations) |
149 | this.licence.label = peertubeTranslate(this.licence.label, translations) | 149 | this.licence.label = peertubeTranslate(this.licence.label, translations) |
diff --git a/client/src/app/shared/shared-moderation/account-blocklist.component.ts b/client/src/app/shared/shared-moderation/account-blocklist.component.ts index 68928a2c2..3de9587b8 100644 --- a/client/src/app/shared/shared-moderation/account-blocklist.component.ts +++ b/client/src/app/shared/shared-moderation/account-blocklist.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Directive, OnInit } from '@angular/core' | 2 | import { Directive, OnInit } from '@angular/core' |
3 | import { Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { Actor } from '@app/shared/shared-main' | 4 | import { Account } from '@app/shared/shared-main' |
5 | import { AccountBlock } from './account-block.model' | 5 | import { AccountBlock } from './account-block.model' |
6 | import { BlocklistComponentType, BlocklistService } from './blocklist.service' | 6 | import { BlocklistComponentType, BlocklistService } from './blocklist.service' |
7 | 7 | ||
@@ -31,7 +31,7 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni | |||
31 | } | 31 | } |
32 | 32 | ||
33 | switchToDefaultAvatar ($event: Event) { | 33 | switchToDefaultAvatar ($event: Event) { |
34 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | 34 | ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL() |
35 | } | 35 | } |
36 | 36 | ||
37 | unblockAccount (accountBlock: AccountBlock) { | 37 | unblockAccount (accountBlock: AccountBlock) { |
diff --git a/client/src/app/shared/shared-video-comment/video-comment.model.ts b/client/src/app/shared/shared-video-comment/video-comment.model.ts index eeee397af..bf718ae08 100644 --- a/client/src/app/shared/shared-video-comment/video-comment.model.ts +++ b/client/src/app/shared/shared-video-comment/video-comment.model.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { getAbsoluteAPIUrl } from '@app/helpers' | 1 | import { getAbsoluteAPIUrl } from '@app/helpers' |
2 | import { Actor } from '@app/shared/shared-main' | 2 | import { Account, Actor } from '@app/shared/shared-main' |
3 | import { Account as AccountInterface, VideoComment as VideoCommentServerModel, VideoCommentAdmin as VideoCommentAdminServerModel } from '@shared/models' | 3 | import { Account as AccountInterface, VideoComment as VideoCommentServerModel, VideoCommentAdmin as VideoCommentAdminServerModel } from '@shared/models' |
4 | 4 | ||
5 | export class VideoComment implements VideoCommentServerModel { | 5 | export class VideoComment implements VideoCommentServerModel { |
@@ -38,7 +38,7 @@ export class VideoComment implements VideoCommentServerModel { | |||
38 | 38 | ||
39 | if (this.account) { | 39 | if (this.account) { |
40 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) | 40 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) |
41 | this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account) | 41 | this.accountAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.account) |
42 | 42 | ||
43 | const absoluteAPIUrl = getAbsoluteAPIUrl() | 43 | const absoluteAPIUrl = getAbsoluteAPIUrl() |
44 | const thisHost = new URL(absoluteAPIUrl).host | 44 | const thisHost = new URL(absoluteAPIUrl).host |
@@ -97,7 +97,7 @@ export class VideoCommentAdmin implements VideoCommentAdminServerModel { | |||
97 | 97 | ||
98 | if (this.account) { | 98 | if (this.account) { |
99 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) | 99 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) |
100 | this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account) | 100 | this.accountAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.account) |
101 | 101 | ||
102 | this.account.localUrl = '/accounts/' + this.by | 102 | this.account.localUrl = '/accounts/' + this.by |
103 | } | 103 | } |
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts index 3db3b7a2e..9bec16d77 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist.model.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist.model.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers' | 1 | import { getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers' |
2 | import { Actor } from '@app/shared/shared-main' | 2 | import { Account, Actor, VideoChannel } from '@app/shared/shared-main' |
3 | import { peertubeTranslate } from '@shared/core-utils/i18n' | 3 | import { peertubeTranslate } from '@shared/core-utils/i18n' |
4 | import { | 4 | import { |
5 | AccountSummary, | 5 | AccountSummary, |
@@ -78,12 +78,12 @@ export class VideoPlaylist implements ServerVideoPlaylist { | |||
78 | 78 | ||
79 | this.ownerAccount = hash.ownerAccount | 79 | this.ownerAccount = hash.ownerAccount |
80 | this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host) | 80 | this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host) |
81 | this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount) | 81 | this.ownerAvatarUrl = Account.GET_ACTOR_AVATAR_URL(this.ownerAccount) |
82 | 82 | ||
83 | if (hash.videoChannel) { | 83 | if (hash.videoChannel) { |
84 | this.videoChannel = hash.videoChannel | 84 | this.videoChannel = hash.videoChannel |
85 | this.videoChannelBy = Actor.CREATE_BY_STRING(hash.videoChannel.name, hash.videoChannel.host) | 85 | this.videoChannelBy = Actor.CREATE_BY_STRING(hash.videoChannel.name, hash.videoChannel.host) |
86 | this.videoChannelAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.videoChannel) | 86 | this.videoChannelAvatarUrl = VideoChannel.GET_ACTOR_AVATAR_URL(this.videoChannel) |
87 | } | 87 | } |
88 | 88 | ||
89 | this.privacy.label = peertubeTranslate(this.privacy.label, translations) | 89 | this.privacy.label = peertubeTranslate(this.privacy.label, translations) |
diff --git a/client/src/assets/images/default-avatar-account.png b/client/src/assets/images/default-avatar-account.png new file mode 100644 index 000000000..0bedaa0c8 --- /dev/null +++ b/client/src/assets/images/default-avatar-account.png | |||
Binary files differ | |||
diff --git a/client/src/assets/images/default-avatar-videochannel.png b/client/src/assets/images/default-avatar-videochannel.png new file mode 100644 index 000000000..e24741815 --- /dev/null +++ b/client/src/assets/images/default-avatar-videochannel.png | |||
Binary files differ | |||
diff --git a/client/src/assets/images/default-avatar.png b/client/src/assets/images/default-avatar.png deleted file mode 100644 index df66422c3..000000000 --- a/client/src/assets/images/default-avatar.png +++ /dev/null | |||
Binary files differ | |||