diff options
Diffstat (limited to 'client')
29 files changed, 36 insertions, 304 deletions
diff --git a/client/src/app/+admin/admin-routing.module.ts b/client/src/app/+admin/admin-routing.module.ts index 7262768fe..88f44a811 100644 --- a/client/src/app/+admin/admin-routing.module.ts +++ b/client/src/app/+admin/admin-routing.module.ts | |||
@@ -5,7 +5,6 @@ import { MetaGuard } from '@ngx-meta/core' | |||
5 | 5 | ||
6 | import { AdminComponent } from './admin.component' | 6 | import { AdminComponent } from './admin.component' |
7 | import { FriendsRoutes } from './friends' | 7 | import { FriendsRoutes } from './friends' |
8 | import { RequestSchedulersRoutes } from './request-schedulers' | ||
9 | import { UsersRoutes } from './users' | 8 | import { UsersRoutes } from './users' |
10 | import { VideoAbusesRoutes } from './video-abuses' | 9 | import { VideoAbusesRoutes } from './video-abuses' |
11 | import { VideoBlacklistRoutes } from './video-blacklist' | 10 | import { VideoBlacklistRoutes } from './video-blacklist' |
@@ -23,7 +22,6 @@ const adminRoutes: Routes = [ | |||
23 | pathMatch: 'full' | 22 | pathMatch: 'full' |
24 | }, | 23 | }, |
25 | ...FriendsRoutes, | 24 | ...FriendsRoutes, |
26 | ...RequestSchedulersRoutes, | ||
27 | ...UsersRoutes, | 25 | ...UsersRoutes, |
28 | ...VideoAbusesRoutes, | 26 | ...VideoAbusesRoutes, |
29 | ...VideoBlacklistRoutes | 27 | ...VideoBlacklistRoutes |
diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index 6c216e5d8..32f6c42a6 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts | |||
@@ -3,7 +3,6 @@ import { NgModule } from '@angular/core' | |||
3 | import { AdminComponent } from './admin.component' | 3 | import { AdminComponent } from './admin.component' |
4 | import { AdminRoutingModule } from './admin-routing.module' | 4 | import { AdminRoutingModule } from './admin-routing.module' |
5 | import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends' | 5 | import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends' |
6 | import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers' | ||
7 | import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users' | 6 | import { UsersComponent, UserAddComponent, UserUpdateComponent, UserListComponent, UserService } from './users' |
8 | import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses' | 7 | import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses' |
9 | import { VideoBlacklistComponent, VideoBlacklistListComponent } from './video-blacklist' | 8 | import { VideoBlacklistComponent, VideoBlacklistListComponent } from './video-blacklist' |
@@ -22,9 +21,6 @@ import { SharedModule } from '../shared' | |||
22 | FriendAddComponent, | 21 | FriendAddComponent, |
23 | FriendListComponent, | 22 | FriendListComponent, |
24 | 23 | ||
25 | RequestSchedulersComponent, | ||
26 | RequestSchedulersStatsComponent, | ||
27 | |||
28 | UsersComponent, | 24 | UsersComponent, |
29 | UserAddComponent, | 25 | UserAddComponent, |
30 | UserUpdateComponent, | 26 | UserUpdateComponent, |
@@ -43,7 +39,6 @@ import { SharedModule } from '../shared' | |||
43 | 39 | ||
44 | providers: [ | 40 | providers: [ |
45 | FriendService, | 41 | FriendService, |
46 | RequestSchedulersService, | ||
47 | UserService | 42 | UserService |
48 | ] | 43 | ] |
49 | }) | 44 | }) |
diff --git a/client/src/app/+admin/friends/friend-add/friend-add.component.ts b/client/src/app/+admin/friends/friend-add/friend-add.component.ts index 6580e1b88..29ed23e0c 100644 --- a/client/src/app/+admin/friends/friend-add/friend-add.component.ts +++ b/client/src/app/+admin/friends/friend-add/friend-add.component.ts | |||
@@ -91,7 +91,7 @@ export class FriendAddComponent implements OnInit { | |||
91 | res => { | 91 | res => { |
92 | if (res === false) return | 92 | if (res === false) return |
93 | 93 | ||
94 | this.friendService.makeFriends(notEmptyHosts).subscribe( | 94 | this.friendService.follow(notEmptyHosts).subscribe( |
95 | status => { | 95 | status => { |
96 | this.notificationsService.success('Success', 'Make friends request sent!') | 96 | this.notificationsService.success('Success', 'Make friends request sent!') |
97 | // Wait requests between pods | 97 | // Wait requests between pods |
diff --git a/client/src/app/+admin/friends/friend-list/friend-list.component.ts b/client/src/app/+admin/friends/friend-list/friend-list.component.ts index 5a1ecd280..0323ae96d 100644 --- a/client/src/app/+admin/friends/friend-list/friend-list.component.ts +++ b/client/src/app/+admin/friends/friend-list/friend-list.component.ts | |||
@@ -74,7 +74,7 @@ export class FriendListComponent extends RestTable implements OnInit { | |||
74 | } | 74 | } |
75 | 75 | ||
76 | protected loadData () { | 76 | protected loadData () { |
77 | this.friendService.getFriends(this.pagination, this.sort) | 77 | this.friendService.getFollowing(this.pagination, this.sort) |
78 | .subscribe( | 78 | .subscribe( |
79 | resultList => { | 79 | resultList => { |
80 | this.friends = resultList.data | 80 | this.friends = resultList.data |
diff --git a/client/src/app/+admin/friends/friends.routes.ts b/client/src/app/+admin/friends/friends.routes.ts index 61cfcae19..e2cb953b3 100644 --- a/client/src/app/+admin/friends/friends.routes.ts +++ b/client/src/app/+admin/friends/friends.routes.ts | |||
@@ -12,7 +12,7 @@ export const FriendsRoutes: Routes = [ | |||
12 | component: FriendsComponent, | 12 | component: FriendsComponent, |
13 | canActivate: [ UserRightGuard ], | 13 | canActivate: [ UserRightGuard ], |
14 | data: { | 14 | data: { |
15 | userRight: UserRight.MANAGE_PODS | 15 | userRight: UserRight.MANAGE_PEERTUBE_FOLLOW |
16 | }, | 16 | }, |
17 | children: [ | 17 | children: [ |
18 | { | 18 | { |
diff --git a/client/src/app/+admin/friends/shared/friend.service.ts b/client/src/app/+admin/friends/shared/friend.service.ts index a32cdcc88..083a2fce0 100644 --- a/client/src/app/+admin/friends/shared/friend.service.ts +++ b/client/src/app/+admin/friends/shared/friend.service.ts | |||
@@ -19,21 +19,21 @@ export class FriendService { | |||
19 | private restExtractor: RestExtractor | 19 | private restExtractor: RestExtractor |
20 | ) {} | 20 | ) {} |
21 | 21 | ||
22 | getFriends (pagination: RestPagination, sort: SortMeta): Observable<ResultList<Pod>> { | 22 | getFollowing (pagination: RestPagination, sort: SortMeta): Observable<ResultList<Pod>> { |
23 | let params = new HttpParams() | 23 | let params = new HttpParams() |
24 | params = this.restService.addRestGetParams(params, pagination, sort) | 24 | params = this.restService.addRestGetParams(params, pagination, sort) |
25 | 25 | ||
26 | return this.authHttp.get<ResultList<Pod>>(FriendService.BASE_FRIEND_URL, { params }) | 26 | return this.authHttp.get<ResultList<Account>>(API_URL + '/followers', { params }) |
27 | .map(res => this.restExtractor.convertResultListDateToHuman(res)) | 27 | .map(res => this.restExtractor.convertResultListDateToHuman(res)) |
28 | .catch(res => this.restExtractor.handleError(res)) | 28 | .catch(res => this.restExtractor.handleError(res)) |
29 | } | 29 | } |
30 | 30 | ||
31 | makeFriends (notEmptyHosts: String[]) { | 31 | follow (notEmptyHosts: String[]) { |
32 | const body = { | 32 | const body = { |
33 | hosts: notEmptyHosts | 33 | hosts: notEmptyHosts |
34 | } | 34 | } |
35 | 35 | ||
36 | return this.authHttp.post(FriendService.BASE_FRIEND_URL + 'make-friends', body) | 36 | return this.authHttp.post(API_URL + '/follow', body) |
37 | .map(this.restExtractor.extractDataBool) | 37 | .map(this.restExtractor.extractDataBool) |
38 | .catch(res => this.restExtractor.handleError(res)) | 38 | .catch(res => this.restExtractor.handleError(res)) |
39 | } | 39 | } |
diff --git a/client/src/app/+admin/request-schedulers/index.ts b/client/src/app/+admin/request-schedulers/index.ts deleted file mode 100644 index 87b72e8c7..000000000 --- a/client/src/app/+admin/request-schedulers/index.ts +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | export * from './request-schedulers-stats' | ||
2 | export * from './shared' | ||
3 | export * from './request-schedulers.component' | ||
4 | export * from './request-schedulers.routes' | ||
diff --git a/client/src/app/+admin/request-schedulers/request-schedulers-stats/index.ts b/client/src/app/+admin/request-schedulers/request-schedulers-stats/index.ts deleted file mode 100644 index a3323e6be..000000000 --- a/client/src/app/+admin/request-schedulers/request-schedulers-stats/index.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export * from './request-schedulers-stats.component' | ||
diff --git a/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.html b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.html deleted file mode 100644 index 4508ab4c2..000000000 --- a/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.html +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <div class="row"> | ||
2 | <div class="content-padding"> | ||
3 | |||
4 | <h3>Requests stats</h3> | ||
5 | |||
6 | <ng-template [ngIf]="stats"> | ||
7 | <div *ngFor="let requestSchedulerName of statsTitles | keys" class="col-lg-4 col-md-12"> | ||
8 | <div class="panel panel-default" *ngIf="stats[requestSchedulerName] !== null"> | ||
9 | <div class="panel-heading">{{ statsTitles[requestSchedulerName] }}</div> | ||
10 | |||
11 | <div class="panel-body"> | ||
12 | <div class="requests-general"> | ||
13 | <div> | ||
14 | <span class="label-description">Remaining requests:</span> | ||
15 | {{ stats[requestSchedulerName].totalRequests }} | ||
16 | </div> | ||
17 | |||
18 | <div> | ||
19 | <span class="label-description">Interval seconds between requests:</span> | ||
20 | {{ stats[requestSchedulerName].secondsInterval }} | ||
21 | </div> | ||
22 | |||
23 | <div> | ||
24 | <span class="label-description">Remaining time before the scheduled request:</span> | ||
25 | {{ stats[requestSchedulerName].remainingSeconds }} | ||
26 | </div> | ||
27 | </div> | ||
28 | |||
29 | <div class="requests-limit"> | ||
30 | <div> | ||
31 | <span class="label-description">Maximum number of different pods for a scheduled request:</span> | ||
32 | {{ stats[requestSchedulerName].requestsLimitPods }} | ||
33 | </div> | ||
34 | |||
35 | <div> | ||
36 | <span class="label-description">Maximum number of requests per pod for a scheduled request:</span> | ||
37 | {{ stats[requestSchedulerName].requestsLimitPerPod }} | ||
38 | </div> | ||
39 | </div> | ||
40 | </div> | ||
41 | </div> | ||
42 | </div> | ||
43 | </ng-template> | ||
44 | |||
45 | </div> | ||
46 | </div> | ||
diff --git a/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.scss b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.scss deleted file mode 100644 index b2c413259..000000000 --- a/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.scss +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | .label-description { | ||
2 | font-weight: bold; | ||
3 | color: black; | ||
4 | } | ||
5 | |||
6 | .requests-limit { | ||
7 | margin-top: 20px; | ||
8 | } | ||
diff --git a/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.ts b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.ts deleted file mode 100644 index 1654827ab..000000000 --- a/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.ts +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | import { Component, OnInit, OnDestroy } from '@angular/core' | ||
2 | |||
3 | import { NotificationsService } from 'angular2-notifications' | ||
4 | |||
5 | import { RequestSchedulersService, RequestSchedulerStatsAttributes } from '../shared' | ||
6 | import { RequestSchedulerStats } from '../../../../../../shared' | ||
7 | |||
8 | @Component({ | ||
9 | selector: 'my-request-schedulers-stats', | ||
10 | templateUrl: './request-schedulers-stats.component.html', | ||
11 | styleUrls: [ './request-schedulers-stats.component.scss' ] | ||
12 | }) | ||
13 | export class RequestSchedulersStatsComponent implements OnInit, OnDestroy { | ||
14 | statsTitles = { | ||
15 | requestScheduler: 'Basic request scheduler', | ||
16 | requestVideoEventScheduler: 'Video events request scheduler', | ||
17 | requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler' | ||
18 | } | ||
19 | |||
20 | stats: RequestSchedulerStats | ||
21 | |||
22 | private intervals: { [ id: string ]: number } = { | ||
23 | requestScheduler: null, | ||
24 | requestVideoEventScheduler: null, | ||
25 | requestVideoQaduScheduler: null | ||
26 | } | ||
27 | |||
28 | private timeouts: { [ id: string ]: number } = { | ||
29 | requestScheduler: null, | ||
30 | requestVideoEventScheduler: null, | ||
31 | requestVideoQaduScheduler: null | ||
32 | } | ||
33 | |||
34 | constructor ( | ||
35 | private notificationsService: NotificationsService, | ||
36 | private requestService: RequestSchedulersService | ||
37 | ) { } | ||
38 | |||
39 | ngOnInit () { | ||
40 | this.getStats() | ||
41 | this.runIntervals() | ||
42 | } | ||
43 | |||
44 | ngOnDestroy () { | ||
45 | Object.keys(this.stats).forEach(requestSchedulerName => { | ||
46 | if (this.intervals[requestSchedulerName] !== null) { | ||
47 | window.clearInterval(this.intervals[requestSchedulerName]) | ||
48 | } | ||
49 | |||
50 | if (this.timeouts[requestSchedulerName] !== null) { | ||
51 | window.clearTimeout(this.timeouts[requestSchedulerName]) | ||
52 | } | ||
53 | }) | ||
54 | } | ||
55 | |||
56 | getStats () { | ||
57 | this.requestService.getStats().subscribe( | ||
58 | stats => this.stats = stats, | ||
59 | |||
60 | err => this.notificationsService.error('Error', err.message) | ||
61 | ) | ||
62 | } | ||
63 | |||
64 | private runIntervals () { | ||
65 | Object.keys(this.intervals).forEach(requestSchedulerName => { | ||
66 | this.intervals[requestSchedulerName] = window.setInterval(() => { | ||
67 | const stats: RequestSchedulerStatsAttributes = this.stats[requestSchedulerName] | ||
68 | |||
69 | stats.remainingMilliSeconds -= 1000 | ||
70 | |||
71 | if (stats.remainingMilliSeconds <= 0) { | ||
72 | this.timeouts[requestSchedulerName] = window.setTimeout(() => this.getStats(), stats.remainingMilliSeconds + 100) | ||
73 | } | ||
74 | }, 1000) | ||
75 | }) | ||
76 | } | ||
77 | } | ||
diff --git a/client/src/app/+admin/request-schedulers/request-schedulers.component.ts b/client/src/app/+admin/request-schedulers/request-schedulers.component.ts deleted file mode 100644 index 5444d6ea5..000000000 --- a/client/src/app/+admin/request-schedulers/request-schedulers.component.ts +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | import { Component } from '@angular/core' | ||
2 | |||
3 | @Component({ | ||
4 | template: '<router-outlet></router-outlet>' | ||
5 | }) | ||
6 | export class RequestSchedulersComponent { | ||
7 | } | ||
diff --git a/client/src/app/+admin/request-schedulers/request-schedulers.routes.ts b/client/src/app/+admin/request-schedulers/request-schedulers.routes.ts deleted file mode 100644 index c2564de15..000000000 --- a/client/src/app/+admin/request-schedulers/request-schedulers.routes.ts +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | import { Routes } from '@angular/router' | ||
2 | |||
3 | import { UserRightGuard } from '../../core' | ||
4 | import { UserRight } from '../../../../../shared' | ||
5 | import { RequestSchedulersComponent } from './request-schedulers.component' | ||
6 | import { RequestSchedulersStatsComponent } from './request-schedulers-stats' | ||
7 | |||
8 | export const RequestSchedulersRoutes: Routes = [ | ||
9 | { | ||
10 | path: 'requests', | ||
11 | component: RequestSchedulersComponent, | ||
12 | canActivate: [ UserRightGuard ], | ||
13 | data: { | ||
14 | userRight: UserRight.MANAGE_REQUEST_SCHEDULERS | ||
15 | }, | ||
16 | children: [ | ||
17 | { | ||
18 | path: '', | ||
19 | redirectTo: 'stats', | ||
20 | pathMatch: 'full' | ||
21 | }, | ||
22 | { | ||
23 | path: 'stats', | ||
24 | component: RequestSchedulersStatsComponent, | ||
25 | data: { | ||
26 | meta: { | ||
27 | title: 'Request stats' | ||
28 | } | ||
29 | } | ||
30 | } | ||
31 | ] | ||
32 | } | ||
33 | ] | ||
diff --git a/client/src/app/+admin/request-schedulers/shared/index.ts b/client/src/app/+admin/request-schedulers/shared/index.ts deleted file mode 100644 index 1a0174409..000000000 --- a/client/src/app/+admin/request-schedulers/shared/index.ts +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | export * from './request-schedulers-stats-attributes.model' | ||
2 | export * from './request-schedulers.service' | ||
diff --git a/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts b/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts deleted file mode 100644 index c4abf3d4d..000000000 --- a/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | import { RequestSchedulerStatsAttributes as FormattedRequestSchedulerStatsAttributes } from '../../../../../../shared' | ||
2 | |||
3 | export interface Request { | ||
4 | request: any | ||
5 | to: any | ||
6 | } | ||
7 | |||
8 | export class RequestSchedulerStatsAttributes implements FormattedRequestSchedulerStatsAttributes { | ||
9 | requestsLimitPods: number | ||
10 | requestsLimitPerPod: number | ||
11 | milliSecondsInterval: number | ||
12 | remainingMilliSeconds: number | ||
13 | totalRequests: number | ||
14 | |||
15 | constructor (hash: { | ||
16 | requestsLimitPods: number, | ||
17 | requestsLimitPerPod: number, | ||
18 | milliSecondsInterval: number, | ||
19 | remainingMilliSeconds: number, | ||
20 | totalRequests: number | ||
21 | }) { | ||
22 | this.requestsLimitPods = hash.requestsLimitPods | ||
23 | this.requestsLimitPerPod = hash.requestsLimitPerPod | ||
24 | this.milliSecondsInterval = hash.milliSecondsInterval | ||
25 | this.remainingMilliSeconds = hash.remainingMilliSeconds | ||
26 | this.totalRequests = hash.totalRequests | ||
27 | } | ||
28 | |||
29 | get remainingSeconds () { | ||
30 | return Math.floor(this.remainingMilliSeconds / 1000) | ||
31 | } | ||
32 | |||
33 | get secondsInterva () { | ||
34 | return Math.floor(this.milliSecondsInterval / 1000) | ||
35 | } | ||
36 | |||
37 | } | ||
diff --git a/client/src/app/+admin/request-schedulers/shared/request-schedulers.service.ts b/client/src/app/+admin/request-schedulers/shared/request-schedulers.service.ts deleted file mode 100644 index 44d9cbc3e..000000000 --- a/client/src/app/+admin/request-schedulers/shared/request-schedulers.service.ts +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { HttpClient } from '@angular/common/http' | ||
3 | import { Observable } from 'rxjs/Observable' | ||
4 | import 'rxjs/add/operator/catch' | ||
5 | import 'rxjs/add/operator/map' | ||
6 | |||
7 | import { RequestSchedulerStats } from '../../../../../../shared' | ||
8 | import { RestExtractor } from '../../../shared' | ||
9 | import { RequestSchedulerStatsAttributes } from './request-schedulers-stats-attributes.model' | ||
10 | |||
11 | @Injectable() | ||
12 | export class RequestSchedulersService { | ||
13 | private static BASE_REQUEST_URL = API_URL + '/api/v1/request-schedulers/' | ||
14 | |||
15 | constructor ( | ||
16 | private authHttp: HttpClient, | ||
17 | private restExtractor: RestExtractor | ||
18 | ) {} | ||
19 | |||
20 | getStats () { | ||
21 | return this.authHttp.get<RequestSchedulerStats>(RequestSchedulersService.BASE_REQUEST_URL + 'stats') | ||
22 | .map(res => this.buildRequestObjects(res)) | ||
23 | .catch(res => this.restExtractor.handleError(res)) | ||
24 | } | ||
25 | |||
26 | private buildRequestObjects (data: RequestSchedulerStats) { | ||
27 | const requestSchedulers: { [ id: string ]: RequestSchedulerStatsAttributes } = {} | ||
28 | |||
29 | Object.keys(data).forEach(requestSchedulerName => { | ||
30 | requestSchedulers[requestSchedulerName] = new RequestSchedulerStatsAttributes(data[requestSchedulerName]) | ||
31 | }) | ||
32 | |||
33 | return requestSchedulers | ||
34 | } | ||
35 | } | ||
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 913c857e3..0aa276c69 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -42,7 +42,7 @@ interface UserLoginWithUserInformation extends UserLogin { | |||
42 | displayNSFW: boolean | 42 | displayNSFW: boolean |
43 | email: string | 43 | email: string |
44 | videoQuota: number | 44 | videoQuota: number |
45 | author: { | 45 | account: { |
46 | id: number | 46 | id: number |
47 | uuid: string | 47 | uuid: string |
48 | } | 48 | } |
@@ -208,7 +208,7 @@ export class AuthService { | |||
208 | this.user.displayNSFW = res.displayNSFW | 208 | this.user.displayNSFW = res.displayNSFW |
209 | this.user.role = res.role | 209 | this.user.role = res.role |
210 | this.user.videoChannels = res.videoChannels | 210 | this.user.videoChannels = res.videoChannels |
211 | this.user.author = res.author | 211 | this.user.account = res.account |
212 | 212 | ||
213 | this.user.save() | 213 | this.user.save() |
214 | } | 214 | } |
@@ -227,7 +227,7 @@ export class AuthService { | |||
227 | displayNSFW: res.displayNSFW, | 227 | displayNSFW: res.displayNSFW, |
228 | email: res.email, | 228 | email: res.email, |
229 | videoQuota: res.videoQuota, | 229 | videoQuota: res.videoQuota, |
230 | author: res.author, | 230 | account: res.account, |
231 | videoChannels: res.videoChannels | 231 | videoChannels: res.videoChannels |
232 | } | 232 | } |
233 | 233 | ||
@@ -245,7 +245,7 @@ export class AuthService { | |||
245 | displayNSFW: obj.displayNSFW, | 245 | displayNSFW: obj.displayNSFW, |
246 | videoQuota: obj.videoQuota, | 246 | videoQuota: obj.videoQuota, |
247 | videoChannels: obj.videoChannels, | 247 | videoChannels: obj.videoChannels, |
248 | author: obj.author | 248 | account: obj.account |
249 | } | 249 | } |
250 | const hashTokens = { | 250 | const hashTokens = { |
251 | accessToken: obj.access_token, | 251 | accessToken: obj.access_token, |
diff --git a/client/src/app/core/menu/menu-admin.component.html b/client/src/app/core/menu/menu-admin.component.html index c2b2958b4..1966a944c 100644 --- a/client/src/app/core/menu/menu-admin.component.html +++ b/client/src/app/core/menu/menu-admin.component.html | |||
@@ -10,11 +10,6 @@ | |||
10 | List friends | 10 | List friends |
11 | </a> | 11 | </a> |
12 | 12 | ||
13 | <a *ngIf="hasRequestsStatRight()" routerLink="/admin/requests/stats" routerLinkActive="active"> | ||
14 | <span class="hidden-xs glyphicon glyphicon-stats"></span> | ||
15 | Request stats | ||
16 | </a> | ||
17 | |||
18 | <a *ngIf="hasVideoAbusesRight()" routerLink="/admin/video-abuses" routerLinkActive="active"> | 13 | <a *ngIf="hasVideoAbusesRight()" routerLink="/admin/video-abuses" routerLinkActive="active"> |
19 | <span class="hidden-xs glyphicon glyphicon-alert"></span> | 14 | <span class="hidden-xs glyphicon glyphicon-alert"></span> |
20 | Video abuses | 15 | Video abuses |
diff --git a/client/src/app/core/menu/menu-admin.component.ts b/client/src/app/core/menu/menu-admin.component.ts index 074f1dbaf..92aab9a05 100644 --- a/client/src/app/core/menu/menu-admin.component.ts +++ b/client/src/app/core/menu/menu-admin.component.ts | |||
@@ -16,11 +16,7 @@ export class MenuAdminComponent { | |||
16 | } | 16 | } |
17 | 17 | ||
18 | hasFriendsRight () { | 18 | hasFriendsRight () { |
19 | return this.auth.getUser().hasRight(UserRight.MANAGE_PODS) | 19 | return this.auth.getUser().hasRight(UserRight.MANAGE_PEERTUBE_FOLLOW) |
20 | } | ||
21 | |||
22 | hasRequestsStatRight () { | ||
23 | return this.auth.getUser().hasRight(UserRight.MANAGE_REQUEST_SCHEDULERS) | ||
24 | } | 20 | } |
25 | 21 | ||
26 | hasVideoAbusesRight () { | 22 | hasVideoAbusesRight () { |
diff --git a/client/src/app/core/menu/menu.component.ts b/client/src/app/core/menu/menu.component.ts index c66a5eccc..71295be86 100644 --- a/client/src/app/core/menu/menu.component.ts +++ b/client/src/app/core/menu/menu.component.ts | |||
@@ -16,8 +16,7 @@ export class MenuComponent implements OnInit { | |||
16 | 16 | ||
17 | private routesPerRight = { | 17 | private routesPerRight = { |
18 | [UserRight.MANAGE_USERS]: '/admin/users', | 18 | [UserRight.MANAGE_USERS]: '/admin/users', |
19 | [UserRight.MANAGE_PODS]: '/admin/friends', | 19 | [UserRight.MANAGE_PEERTUBE_FOLLOW]: '/admin/friends', |
20 | [UserRight.MANAGE_REQUEST_SCHEDULERS]: '/admin/requests/stats', | ||
21 | [UserRight.MANAGE_VIDEO_ABUSES]: '/admin/video-abuses', | 20 | [UserRight.MANAGE_VIDEO_ABUSES]: '/admin/video-abuses', |
22 | [UserRight.MANAGE_VIDEO_BLACKLIST]: '/admin/video-blacklist' | 21 | [UserRight.MANAGE_VIDEO_BLACKLIST]: '/admin/video-blacklist' |
23 | } | 22 | } |
@@ -59,8 +58,7 @@ export class MenuComponent implements OnInit { | |||
59 | 58 | ||
60 | const adminRights = [ | 59 | const adminRights = [ |
61 | UserRight.MANAGE_USERS, | 60 | UserRight.MANAGE_USERS, |
62 | UserRight.MANAGE_PODS, | 61 | UserRight.MANAGE_PEERTUBE_FOLLOW, |
63 | UserRight.MANAGE_REQUEST_SCHEDULERS, | ||
64 | UserRight.MANAGE_VIDEO_ABUSES, | 62 | UserRight.MANAGE_VIDEO_ABUSES, |
65 | UserRight.MANAGE_VIDEO_BLACKLIST | 63 | UserRight.MANAGE_VIDEO_BLACKLIST |
66 | ] | 64 | ] |
diff --git a/client/src/app/shared/search/search-field.type.ts b/client/src/app/shared/search/search-field.type.ts index ff0bb8de1..7323d6cc3 100644 --- a/client/src/app/shared/search/search-field.type.ts +++ b/client/src/app/shared/search/search-field.type.ts | |||
@@ -1 +1 @@ | |||
export type SearchField = 'name' | 'author' | 'host' | 'tags' | export type SearchField = 'name' | 'account' | 'host' | 'tags' | ||
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts index 6e2827fe3..6ef19c97a 100644 --- a/client/src/app/shared/search/search.component.ts +++ b/client/src/app/shared/search/search.component.ts | |||
@@ -14,8 +14,8 @@ import { SearchService } from './search.service' | |||
14 | export class SearchComponent implements OnInit { | 14 | export class SearchComponent implements OnInit { |
15 | fieldChoices = { | 15 | fieldChoices = { |
16 | name: 'Name', | 16 | name: 'Name', |
17 | author: 'Author', | 17 | account: 'Account', |
18 | host: 'Pod Host', | 18 | host: 'Host', |
19 | tags: 'Tags' | 19 | tags: 'Tags' |
20 | } | 20 | } |
21 | searchCriteria: Search = { | 21 | searchCriteria: Search = { |
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index d738899ab..b075ab717 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts | |||
@@ -14,7 +14,7 @@ export type UserConstructorHash = { | |||
14 | videoQuota?: number, | 14 | videoQuota?: number, |
15 | displayNSFW?: boolean, | 15 | displayNSFW?: boolean, |
16 | createdAt?: Date, | 16 | createdAt?: Date, |
17 | author?: { | 17 | account?: { |
18 | id: number | 18 | id: number |
19 | uuid: string | 19 | uuid: string |
20 | }, | 20 | }, |
@@ -27,7 +27,7 @@ export class User implements UserServerModel { | |||
27 | role: UserRole | 27 | role: UserRole |
28 | displayNSFW: boolean | 28 | displayNSFW: boolean |
29 | videoQuota: number | 29 | videoQuota: number |
30 | author: { | 30 | account: { |
31 | id: number | 31 | id: number |
32 | uuid: string | 32 | uuid: string |
33 | } | 33 | } |
@@ -39,7 +39,7 @@ export class User implements UserServerModel { | |||
39 | this.username = hash.username | 39 | this.username = hash.username |
40 | this.email = hash.email | 40 | this.email = hash.email |
41 | this.role = hash.role | 41 | this.role = hash.role |
42 | this.author = hash.author | 42 | this.account = hash.account |
43 | 43 | ||
44 | if (hash.videoChannels !== undefined) { | 44 | if (hash.videoChannels !== undefined) { |
45 | this.videoChannels = hash.videoChannels | 45 | this.videoChannels = hash.videoChannels |
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html index 0bab18d37..ee7bbec74 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html | |||
@@ -42,8 +42,8 @@ | |||
42 | </div> | 42 | </div> |
43 | 43 | ||
44 | <div class="row video-small-blocks"> | 44 | <div class="row video-small-blocks"> |
45 | <div class="col-xs-5 col-xs-3 col-md-3 video-small-block video-small-block-author"> | 45 | <div class="col-xs-5 col-xs-3 col-md-3 video-small-block video-small-block-account"> |
46 | <a class="option" title="Access to all videos of this user" [routerLink]="['/videos/list', { field: 'author', search: video.author }]"> | 46 | <a class="option" title="Access to all videos of this user" [routerLink]="['/videos/list', { field: 'account', search: video.account }]"> |
47 | <span class="glyphicon glyphicon-user"></span> | 47 | <span class="glyphicon glyphicon-user"></span> |
48 | <span class="video-small-block-text">{{ video.by }}</span> | 48 | <span class="video-small-block-text">{{ video.by }}</span> |
49 | </a> | 49 | </a> |
diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss index 1a59a1bd3..fcad7f7b0 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.scss +++ b/client/src/app/videos/+video-watch/video-watch.component.scss | |||
@@ -104,7 +104,7 @@ | |||
104 | border-style: solid; | 104 | border-style: solid; |
105 | } | 105 | } |
106 | 106 | ||
107 | .video-small-block-author, .video-small-block-more { | 107 | .video-small-block-account, .video-small-block-more { |
108 | a.option { | 108 | a.option { |
109 | display: block; | 109 | display: block; |
110 | 110 | ||
@@ -234,7 +234,7 @@ | |||
234 | font-size: 18px !important; | 234 | font-size: 18px !important; |
235 | } | 235 | } |
236 | 236 | ||
237 | .video-small-block-author { | 237 | .video-small-block-account { |
238 | padding-left: 10px; | 238 | padding-left: 10px; |
239 | padding-right: 10px; | 239 | padding-right: 10px; |
240 | } | 240 | } |
@@ -267,7 +267,7 @@ | |||
267 | font-size: 10px !important; | 267 | font-size: 10px !important; |
268 | } | 268 | } |
269 | 269 | ||
270 | .video-small-block-author { | 270 | .video-small-block-account { |
271 | padding-left: 5px; | 271 | padding-left: 5px; |
272 | padding-right: 5px; | 272 | padding-right: 5px; |
273 | } | 273 | } |
diff --git a/client/src/app/videos/shared/video-details.model.ts b/client/src/app/videos/shared/video-details.model.ts index 84f96a25f..f4ae64dc1 100644 --- a/client/src/app/videos/shared/video-details.model.ts +++ b/client/src/app/videos/shared/video-details.model.ts | |||
@@ -10,7 +10,7 @@ import { | |||
10 | } from '../../../../../shared' | 10 | } from '../../../../../shared' |
11 | 11 | ||
12 | export class VideoDetails extends Video implements VideoDetailsServerModel { | 12 | export class VideoDetails extends Video implements VideoDetailsServerModel { |
13 | author: string | 13 | account: string |
14 | by: string | 14 | by: string |
15 | createdAt: Date | 15 | createdAt: Date |
16 | updatedAt: Date | 16 | updatedAt: Date |
@@ -71,7 +71,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
71 | } | 71 | } |
72 | 72 | ||
73 | isRemovableBy (user: AuthUser) { | 73 | isRemovableBy (user: AuthUser) { |
74 | return user && this.isLocal === true && (this.author === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO)) | 74 | return user && this.isLocal === true && (this.account === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO)) |
75 | } | 75 | } |
76 | 76 | ||
77 | isBlackistableBy (user: AuthUser) { | 77 | isBlackistableBy (user: AuthUser) { |
@@ -79,6 +79,6 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | isUpdatableBy (user: AuthUser) { | 81 | isUpdatableBy (user: AuthUser) { |
82 | return user && this.isLocal === true && user.username === this.author | 82 | return user && this.isLocal === true && user.username === this.account |
83 | } | 83 | } |
84 | } | 84 | } |
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts index 7f2871032..2cad4a04e 100644 --- a/client/src/app/videos/shared/video.model.ts +++ b/client/src/app/videos/shared/video.model.ts | |||
@@ -2,7 +2,7 @@ import { Video as VideoServerModel } from '../../../../../shared' | |||
2 | import { User } from '../../shared' | 2 | import { User } from '../../shared' |
3 | 3 | ||
4 | export class Video implements VideoServerModel { | 4 | export class Video implements VideoServerModel { |
5 | author: string | 5 | account: string |
6 | by: string | 6 | by: string |
7 | createdAt: Date | 7 | createdAt: Date |
8 | updatedAt: Date | 8 | updatedAt: Date |
@@ -32,8 +32,8 @@ export class Video implements VideoServerModel { | |||
32 | dislikes: number | 32 | dislikes: number |
33 | nsfw: boolean | 33 | nsfw: boolean |
34 | 34 | ||
35 | private static createByString (author: string, podHost: string) { | 35 | private static createByString (account: string, podHost: string) { |
36 | return author + '@' + podHost | 36 | return account + '@' + podHost |
37 | } | 37 | } |
38 | 38 | ||
39 | private static createDurationString (duration: number) { | 39 | private static createDurationString (duration: number) { |
@@ -52,7 +52,7 @@ export class Video implements VideoServerModel { | |||
52 | absoluteAPIUrl = window.location.origin | 52 | absoluteAPIUrl = window.location.origin |
53 | } | 53 | } |
54 | 54 | ||
55 | this.author = hash.author | 55 | this.account = hash.account |
56 | this.createdAt = new Date(hash.createdAt.toString()) | 56 | this.createdAt = new Date(hash.createdAt.toString()) |
57 | this.categoryLabel = hash.categoryLabel | 57 | this.categoryLabel = hash.categoryLabel |
58 | this.category = hash.category | 58 | this.category = hash.category |
@@ -80,7 +80,7 @@ export class Video implements VideoServerModel { | |||
80 | this.dislikes = hash.dislikes | 80 | this.dislikes = hash.dislikes |
81 | this.nsfw = hash.nsfw | 81 | this.nsfw = hash.nsfw |
82 | 82 | ||
83 | this.by = Video.createByString(hash.author, hash.podHost) | 83 | this.by = Video.createByString(hash.account, hash.podHost) |
84 | } | 84 | } |
85 | 85 | ||
86 | isVideoNSFWForUser (user: User) { | 86 | isVideoNSFWForUser (user: User) { |
diff --git a/client/src/app/videos/video-list/shared/video-miniature.component.html b/client/src/app/videos/video-list/shared/video-miniature.component.html index abe87025f..6bbd29666 100644 --- a/client/src/app/videos/video-list/shared/video-miniature.component.html +++ b/client/src/app/videos/video-list/shared/video-miniature.component.html | |||
@@ -27,7 +27,7 @@ | |||
27 | </span> | 27 | </span> |
28 | </div> | 28 | </div> |
29 | 29 | ||
30 | <a [routerLink]="['/videos/list', { field: 'author', search: video.author, sort: currentSort }]" class="video-miniature-author">{{ video.by }}</a> | 30 | <a [routerLink]="['/videos/list', { field: 'account', search: video.account, sort: currentSort }]" class="video-miniature-account">{{ video.by }}</a> |
31 | <span class="video-miniature-created-at">{{ video.createdAt | date:'short' }}</span> | 31 | <span class="video-miniature-created-at">{{ video.createdAt | date:'short' }}</span> |
32 | </div> | 32 | </div> |
33 | </div> | 33 | </div> |
diff --git a/client/src/app/videos/video-list/shared/video-miniature.component.scss b/client/src/app/videos/video-list/shared/video-miniature.component.scss index e2602d3b6..507ace098 100644 --- a/client/src/app/videos/video-list/shared/video-miniature.component.scss +++ b/client/src/app/videos/video-list/shared/video-miniature.component.scss | |||
@@ -81,7 +81,7 @@ | |||
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | .video-miniature-author, .video-miniature-created-at { | 84 | .video-miniature-account, .video-miniature-created-at { |
85 | display: block; | 85 | display: block; |
86 | margin-left: 1px; | 86 | margin-left: 1px; |
87 | font-size: 11px; | 87 | font-size: 11px; |
@@ -89,7 +89,7 @@ | |||
89 | opacity: 0.9; | 89 | opacity: 0.9; |
90 | } | 90 | } |
91 | 91 | ||
92 | .video-miniature-author { | 92 | .video-miniature-account { |
93 | transition: color 0.2s; | 93 | transition: color 0.2s; |
94 | 94 | ||
95 | &:hover { | 95 | &:hover { |