aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/account/account.model.ts2
-rw-r--r--client/src/app/shared/users/user.model.ts21
-rw-r--r--client/src/app/shared/video-channel/video-channel.service.ts5
-rw-r--r--client/src/app/shared/video/video-details.model.ts4
-rw-r--r--client/src/app/shared/video/video-miniature.component.html4
-rw-r--r--client/src/app/shared/video/video.service.ts2
6 files changed, 28 insertions, 10 deletions
diff --git a/client/src/app/shared/account/account.model.ts b/client/src/app/shared/account/account.model.ts
index 6a3c6451c..5058e372f 100644
--- a/client/src/app/shared/account/account.model.ts
+++ b/client/src/app/shared/account/account.model.ts
@@ -4,11 +4,13 @@ import { Actor } from '../actor/actor.model'
4export class Account extends Actor implements ServerAccount { 4export class Account extends Actor implements ServerAccount {
5 displayName: string 5 displayName: string
6 description: string 6 description: string
7 nameWithHost: string
7 8
8 constructor (hash: ServerAccount) { 9 constructor (hash: ServerAccount) {
9 super(hash) 10 super(hash)
10 11
11 this.displayName = hash.displayName 12 this.displayName = hash.displayName
12 this.description = hash.description 13 this.description = hash.description
14 this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host)
13 } 15 }
14} 16}
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index d4551de89..b4be2270f 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -1,6 +1,14 @@
1import { Account, hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' 1import {
2 Account as AccountServerModel,
3 hasUserRight,
4 User as UserServerModel,
5 UserRight,
6 UserRole,
7 VideoChannel
8} from '../../../../../shared'
2import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' 9import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
3import { Actor } from '@app/shared/actor/actor.model' 10import { Actor } from '@app/shared/actor/actor.model'
11import { Account } from '@app/shared/account/account.model'
4 12
5export type UserConstructorHash = { 13export type UserConstructorHash = {
6 id: number, 14 id: number,
@@ -11,7 +19,7 @@ export type UserConstructorHash = {
11 nsfwPolicy?: NSFWPolicyType, 19 nsfwPolicy?: NSFWPolicyType,
12 autoPlayVideo?: boolean, 20 autoPlayVideo?: boolean,
13 createdAt?: Date, 21 createdAt?: Date,
14 account?: Account, 22 account?: AccountServerModel,
15 videoChannels?: VideoChannel[] 23 videoChannels?: VideoChannel[]
16} 24}
17export class User implements UserServerModel { 25export class User implements UserServerModel {
@@ -32,7 +40,10 @@ export class User implements UserServerModel {
32 this.username = hash.username 40 this.username = hash.username
33 this.email = hash.email 41 this.email = hash.email
34 this.role = hash.role 42 this.role = hash.role
35 this.account = hash.account 43
44 if (hash.account !== undefined) {
45 this.account = new Account(hash.account)
46 }
36 47
37 if (hash.videoChannels !== undefined) { 48 if (hash.videoChannels !== undefined) {
38 this.videoChannels = hash.videoChannels 49 this.videoChannels = hash.videoChannels
@@ -66,6 +77,10 @@ export class User implements UserServerModel {
66 this[key] = obj[key] 77 this[key] = obj[key]
67 } 78 }
68 79
80 if (obj.account !== undefined) {
81 this.account = new Account(obj.account)
82 }
83
69 this.updateComputedAttributes() 84 this.updateComputedAttributes()
70 } 85 }
71 86
diff --git a/client/src/app/shared/video-channel/video-channel.service.ts b/client/src/app/shared/video-channel/video-channel.service.ts
index e1e3bf697..55e4c2a31 100644
--- a/client/src/app/shared/video-channel/video-channel.service.ts
+++ b/client/src/app/shared/video-channel/video-channel.service.ts
@@ -8,6 +8,7 @@ import { AccountService } from '../account/account.service'
8import { ResultList } from '../../../../../shared' 8import { ResultList } from '../../../../../shared'
9import { VideoChannel } from './video-channel.model' 9import { VideoChannel } from './video-channel.model'
10import { environment } from '../../../environments/environment' 10import { environment } from '../../../environments/environment'
11import { Account } from '@app/shared/account/account.model'
11 12
12@Injectable() 13@Injectable()
13export class VideoChannelService { 14export class VideoChannelService {
@@ -29,8 +30,8 @@ export class VideoChannelService {
29 ) 30 )
30 } 31 }
31 32
32 listAccountVideoChannels (accountId: number): Observable<ResultList<VideoChannel>> { 33 listAccountVideoChannels (account: Account): Observable<ResultList<VideoChannel>> {
33 return this.authHttp.get<ResultList<VideoChannelServer>>(AccountService.BASE_ACCOUNT_URL + accountId + '/video-channels') 34 return this.authHttp.get<ResultList<VideoChannelServer>>(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/video-channels')
34 .pipe( 35 .pipe(
35 map(res => this.extractVideoChannels(res)), 36 map(res => this.extractVideoChannels(res)),
36 catchError((res) => this.restExtractor.handleError(res)) 37 catchError((res) => this.restExtractor.handleError(res))
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts
index 5397aa37f..5fc55fca6 100644
--- a/client/src/app/shared/video/video-details.model.ts
+++ b/client/src/app/shared/video/video-details.model.ts
@@ -1,7 +1,7 @@
1import { UserRight, VideoChannel, VideoDetails as VideoDetailsServerModel, VideoFile } from '../../../../../shared' 1import { UserRight, VideoChannel, VideoDetails as VideoDetailsServerModel, VideoFile } from '../../../../../shared'
2import { Account } from '../../../../../shared/models/actors'
3import { AuthUser } from '../../core' 2import { AuthUser } from '../../core'
4import { Video } from '../../shared/video/video.model' 3import { Video } from '../../shared/video/video.model'
4import { Account } from '@app/shared/account/account.model'
5 5
6export class VideoDetails extends Video implements VideoDetailsServerModel { 6export class VideoDetails extends Video implements VideoDetailsServerModel {
7 descriptionPath: string 7 descriptionPath: string
@@ -21,7 +21,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
21 this.descriptionPath = hash.descriptionPath 21 this.descriptionPath = hash.descriptionPath
22 this.files = hash.files 22 this.files = hash.files
23 this.channel = hash.channel 23 this.channel = hash.channel
24 this.account = hash.account 24 this.account = new Account(hash.account)
25 this.tags = hash.tags 25 this.tags = hash.tags
26 this.support = hash.support 26 this.support = hash.support
27 this.commentsEnabled = hash.commentsEnabled 27 this.commentsEnabled = hash.commentsEnabled
diff --git a/client/src/app/shared/video/video-miniature.component.html b/client/src/app/shared/video/video-miniature.component.html
index 1725e9f5c..09ce0ef7f 100644
--- a/client/src/app/shared/video/video-miniature.component.html
+++ b/client/src/app/shared/video/video-miniature.component.html
@@ -6,10 +6,10 @@
6 class="video-miniature-name" 6 class="video-miniature-name"
7 [routerLink]="[ '/videos/watch', video.uuid ]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur() }" 7 [routerLink]="[ '/videos/watch', video.uuid ]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur() }"
8 > 8 >
9 {{ video.name }} 9 {{ video.name }}
10 </a> 10 </a>
11 11
12 <span class="video-miniature-created-at-views">{{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views</span> 12 <span class="video-miniature-created-at-views">{{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views</span>
13 <a class="video-miniature-account" [routerLink]="[ '/accounts', video.account.id ]">{{ video.by }}</a> 13 <a class="video-miniature-account" [routerLink]="[ '/accounts', video.by ]">{{ video.by }}</a>
14 </div> 14 </div>
15</div> 15</div>
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 5b8e2467a..d1e32faeb 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -120,7 +120,7 @@ export class VideoService {
120 params = this.restService.addRestGetParams(params, pagination, sort) 120 params = this.restService.addRestGetParams(params, pagination, sort)
121 121
122 return this.authHttp 122 return this.authHttp
123 .get(AccountService.BASE_ACCOUNT_URL + account.id + '/videos', { params }) 123 .get(AccountService.BASE_ACCOUNT_URL + account.nameWithHost + '/videos', { params })
124 .pipe( 124 .pipe(
125 map(this.extractVideos), 125 map(this.extractVideos),
126 catchError(res => this.restExtractor.handleError(res)) 126 catchError(res => this.restExtractor.handleError(res))