aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/app/videos/shared
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-27 17:25:52 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-27 17:25:52 +0200
commitccf6ed16f1eeb05b77103bd44bc06ccbbbba9bdd (patch)
tree1765f48824be934e0be07e8a987a9513c58ba3da /client/app/videos/shared
parent41a2aee38cf812510010da09de9bae53590ec119 (diff)
downloadPeerTube-ccf6ed16f1eeb05b77103bd44bc06ccbbbba9bdd.tar.gz
PeerTube-ccf6ed16f1eeb05b77103bd44bc06ccbbbba9bdd.tar.zst
PeerTube-ccf6ed16f1eeb05b77103bd44bc06ccbbbba9bdd.zip
Do not prefix private attributes
Diffstat (limited to 'client/app/videos/shared')
-rw-r--r--client/app/videos/shared/video.model.ts6
-rw-r--r--client/app/videos/shared/video.service.ts18
2 files changed, 12 insertions, 12 deletions
diff --git a/client/app/videos/shared/video.model.ts b/client/app/videos/shared/video.model.ts
index eec537c9e..2b018ad86 100644
--- a/client/app/videos/shared/video.model.ts
+++ b/client/app/videos/shared/video.model.ts
@@ -11,7 +11,7 @@ export class Video {
11 by: string; 11 by: string;
12 duration: string; 12 duration: string;
13 13
14 private static createDurationString(duration: number): string { 14 private static createDurationString(duration: number) {
15 const minutes = Math.floor(duration / 60); 15 const minutes = Math.floor(duration / 60);
16 const seconds = duration % 60; 16 const seconds = duration % 60;
17 const minutes_padding = minutes >= 10 ? '' : '0'; 17 const minutes_padding = minutes >= 10 ? '' : '0';
@@ -20,7 +20,7 @@ export class Video {
20 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString(); 20 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
21 } 21 }
22 22
23 private static createByString(author: string, podUrl: string): string { 23 private static createByString(author: string, podUrl: string) {
24 let [ host, port ] = podUrl.replace(/^https?:\/\//, '').split(':'); 24 let [ host, port ] = podUrl.replace(/^https?:\/\//, '').split(':');
25 25
26 if (port === '80' || port === '443') { 26 if (port === '80' || port === '443') {
@@ -57,7 +57,7 @@ export class Video {
57 this.by = Video.createByString(hash.author, hash.podUrl); 57 this.by = Video.createByString(hash.author, hash.podUrl);
58 } 58 }
59 59
60 isRemovableBy(user): boolean { 60 isRemovableBy(user) {
61 return this.isLocal === true && user && this.author === user.username; 61 return this.isLocal === true && user && this.author === user.username;
62 } 62 }
63} 63}
diff --git a/client/app/videos/shared/video.service.ts b/client/app/videos/shared/video.service.ts
index 78789c3cc..b6e0800a0 100644
--- a/client/app/videos/shared/video.service.ts
+++ b/client/app/videos/shared/video.service.ts
@@ -10,30 +10,30 @@ import { Video } from './video.model';
10 10
11@Injectable() 11@Injectable()
12export class VideoService { 12export class VideoService {
13 private _baseVideoUrl = '/api/v1/videos/'; 13 private static BASE_VIDEO_URL = '/api/v1/videos/';
14 14
15 constructor (private http: Http, private _authService: AuthService) {} 15 constructor(private http: Http, private authService: AuthService) {}
16 16
17 getVideos(pagination: Pagination, sort: SortField) { 17 getVideos(pagination: Pagination, sort: SortField) {
18 const params = this.createPaginationParams(pagination); 18 const params = this.createPaginationParams(pagination);
19 19
20 if (sort) params.set('sort', sort); 20 if (sort) params.set('sort', sort);
21 21
22 return this.http.get(this._baseVideoUrl, { search: params }) 22 return this.http.get(VideoService.BASE_VIDEO_URL, { search: params })
23 .map(res => res.json()) 23 .map(res => res.json())
24 .map(this.extractVideos) 24 .map(this.extractVideos)
25 .catch(this.handleError); 25 .catch(this.handleError);
26 } 26 }
27 27
28 getVideo(id: string) { 28 getVideo(id: string) {
29 return this.http.get(this._baseVideoUrl + id) 29 return this.http.get(VideoService.BASE_VIDEO_URL + id)
30 .map(res => <Video> res.json()) 30 .map(res => <Video> res.json())
31 .catch(this.handleError); 31 .catch(this.handleError);
32 } 32 }
33 33
34 removeVideo(id: string) { 34 removeVideo(id: string) {
35 const options = this._authService.getAuthRequestOptions(); 35 const options = this.authService.getAuthRequestOptions();
36 return this.http.delete(this._baseVideoUrl + id, options) 36 return this.http.delete(VideoService.BASE_VIDEO_URL + id, options)
37 .map(res => <number> res.status) 37 .map(res => <number> res.status)
38 .catch(this.handleError); 38 .catch(this.handleError);
39 } 39 }
@@ -44,13 +44,13 @@ export class VideoService {
44 if (search.field) params.set('field', search.field); 44 if (search.field) params.set('field', search.field);
45 if (sort) params.set('sort', sort); 45 if (sort) params.set('sort', sort);
46 46
47 return this.http.get(this._baseVideoUrl + 'search/' + encodeURIComponent(search.value), { search: params }) 47 return this.http.get(VideoService.BASE_VIDEO_URL + 'search/' + encodeURIComponent(search.value), { search: params })
48 .map(res => res.json()) 48 .map(res => res.json())
49 .map(this.extractVideos) 49 .map(this.extractVideos)
50 .catch(this.handleError); 50 .catch(this.handleError);
51 } 51 }
52 52
53 private extractVideos (body: any) { 53 private extractVideos(body: any) {
54 const videos_json = body.data; 54 const videos_json = body.data;
55 const totalVideos = body.total; 55 const totalVideos = body.total;
56 const videos = []; 56 const videos = [];
@@ -61,7 +61,7 @@ export class VideoService {
61 return { videos, totalVideos }; 61 return { videos, totalVideos };
62 } 62 }
63 63
64 private handleError (error: Response) { 64 private handleError(error: Response) {
65 console.error(error); 65 console.error(error);
66 return Observable.throw(error.json().error || 'Server error'); 66 return Observable.throw(error.json().error || 'Server error');
67 } 67 }