diff options
author | Lucas Declercq <lucas.declercq@ineat-conseil.fr> | 2018-10-06 19:17:21 +0200 |
---|---|---|
committer | Lucas Declercq <lucas.declercq@ineat-conseil.fr> | 2018-10-06 19:17:39 +0200 |
commit | 156c50af3085468a47b8ae73fe8cfcae46b42398 (patch) | |
tree | f316355ebea2550c201a880cfc9f9b724bf0f7fd /client/src | |
parent | 35d50b7dd26b3cf646b8845784927bb1ef18dfb3 (diff) | |
download | PeerTube-156c50af3085468a47b8ae73fe8cfcae46b42398.tar.gz PeerTube-156c50af3085468a47b8ae73fe8cfcae46b42398.tar.zst PeerTube-156c50af3085468a47b8ae73fe8cfcae46b42398.zip |
Add downloadingEnabled property to video model
Diffstat (limited to 'client/src')
9 files changed, 19 insertions, 2 deletions
diff --git a/client/src/app/shared/video-import/video-import.service.ts b/client/src/app/shared/video-import/video-import.service.ts index 7ae66ddfc..74c458645 100644 --- a/client/src/app/shared/video-import/video-import.service.ts +++ b/client/src/app/shared/video-import/video-import.service.ts | |||
@@ -81,6 +81,7 @@ export class VideoImportService { | |||
81 | nsfw: video.nsfw, | 81 | nsfw: video.nsfw, |
82 | waitTranscoding: video.waitTranscoding, | 82 | waitTranscoding: video.waitTranscoding, |
83 | commentsEnabled: video.commentsEnabled, | 83 | commentsEnabled: video.commentsEnabled, |
84 | downloadingEnabled: video.downloadingEnabled, | ||
84 | thumbnailfile: video.thumbnailfile, | 85 | thumbnailfile: video.thumbnailfile, |
85 | previewfile: video.previewfile, | 86 | previewfile: video.previewfile, |
86 | scheduleUpdate | 87 | scheduleUpdate |
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts index fa4ca7f93..ad85641dc 100644 --- a/client/src/app/shared/video/video-details.model.ts +++ b/client/src/app/shared/video/video-details.model.ts | |||
@@ -12,6 +12,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
12 | files: VideoFile[] | 12 | files: VideoFile[] |
13 | account: Account | 13 | account: Account |
14 | commentsEnabled: boolean | 14 | commentsEnabled: boolean |
15 | downloadingEnabled: boolean | ||
15 | 16 | ||
16 | waitTranscoding: boolean | 17 | waitTranscoding: boolean |
17 | state: VideoConstant<VideoState> | 18 | state: VideoConstant<VideoState> |
@@ -29,6 +30,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { | |||
29 | this.tags = hash.tags | 30 | this.tags = hash.tags |
30 | this.support = hash.support | 31 | this.support = hash.support |
31 | this.commentsEnabled = hash.commentsEnabled | 32 | this.commentsEnabled = hash.commentsEnabled |
33 | this.downloadingEnabled = hash.downloadingEnabled | ||
32 | 34 | ||
33 | this.buildLikeAndDislikePercents() | 35 | this.buildLikeAndDislikePercents() |
34 | } | 36 | } |
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts index 0046be964..47703ff79 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/video/video-edit.model.ts | |||
@@ -14,6 +14,7 @@ export class VideoEdit implements VideoUpdate { | |||
14 | tags: string[] | 14 | tags: string[] |
15 | nsfw: boolean | 15 | nsfw: boolean |
16 | commentsEnabled: boolean | 16 | commentsEnabled: boolean |
17 | downloadingEnabled: boolean | ||
17 | waitTranscoding: boolean | 18 | waitTranscoding: boolean |
18 | channelId: number | 19 | channelId: number |
19 | privacy: VideoPrivacy | 20 | privacy: VideoPrivacy |
@@ -26,7 +27,7 @@ export class VideoEdit implements VideoUpdate { | |||
26 | id?: number | 27 | id?: number |
27 | scheduleUpdate?: VideoScheduleUpdate | 28 | scheduleUpdate?: VideoScheduleUpdate |
28 | 29 | ||
29 | constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { | 30 | constructor (video?: Video & { tags: string[], commentsEnabled: boolean, downloadingEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { |
30 | if (video) { | 31 | if (video) { |
31 | this.id = video.id | 32 | this.id = video.id |
32 | this.uuid = video.uuid | 33 | this.uuid = video.uuid |
@@ -38,6 +39,7 @@ export class VideoEdit implements VideoUpdate { | |||
38 | this.tags = video.tags | 39 | this.tags = video.tags |
39 | this.nsfw = video.nsfw | 40 | this.nsfw = video.nsfw |
40 | this.commentsEnabled = video.commentsEnabled | 41 | this.commentsEnabled = video.commentsEnabled |
42 | this.downloadingEnabled = video.downloadingEnabled | ||
41 | this.waitTranscoding = video.waitTranscoding | 43 | this.waitTranscoding = video.waitTranscoding |
42 | this.channelId = video.channel.id | 44 | this.channelId = video.channel.id |
43 | this.privacy = video.privacy.id | 45 | this.privacy = video.privacy.id |
@@ -80,6 +82,7 @@ export class VideoEdit implements VideoUpdate { | |||
80 | tags: this.tags, | 82 | tags: this.tags, |
81 | nsfw: this.nsfw, | 83 | nsfw: this.nsfw, |
82 | commentsEnabled: this.commentsEnabled, | 84 | commentsEnabled: this.commentsEnabled, |
85 | downloadingEnabled: this.downloadingEnabled, | ||
83 | waitTranscoding: this.waitTranscoding, | 86 | waitTranscoding: this.waitTranscoding, |
84 | channelId: this.channelId, | 87 | channelId: this.channelId, |
85 | privacy: this.privacy | 88 | privacy: this.privacy |
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index 724a0bde9..c0339dd39 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts | |||
@@ -95,6 +95,7 @@ export class VideoService implements VideosProvider { | |||
95 | nsfw: video.nsfw, | 95 | nsfw: video.nsfw, |
96 | waitTranscoding: video.waitTranscoding, | 96 | waitTranscoding: video.waitTranscoding, |
97 | commentsEnabled: video.commentsEnabled, | 97 | commentsEnabled: video.commentsEnabled, |
98 | downloadingEnabled: video.downloadingEnabled, | ||
98 | thumbnailfile: video.thumbnailfile, | 99 | thumbnailfile: video.thumbnailfile, |
99 | previewfile: video.previewfile, | 100 | previewfile: video.previewfile, |
100 | scheduleUpdate | 101 | scheduleUpdate |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 0f7184ff8..57cf0e395 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -77,6 +77,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
77 | privacy: this.firstStepPrivacyId, | 77 | privacy: this.firstStepPrivacyId, |
78 | waitTranscoding: false, | 78 | waitTranscoding: false, |
79 | commentsEnabled: true, | 79 | commentsEnabled: true, |
80 | downloadingEnabled: true, | ||
80 | channelId: this.firstStepChannelId | 81 | channelId: this.firstStepChannelId |
81 | } | 82 | } |
82 | 83 | ||
@@ -91,6 +92,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
91 | 92 | ||
92 | this.video = new VideoEdit(Object.assign(res.video, { | 93 | this.video = new VideoEdit(Object.assign(res.video, { |
93 | commentsEnabled: videoUpdate.commentsEnabled, | 94 | commentsEnabled: videoUpdate.commentsEnabled, |
95 | downloadingEnabled: videoUpdate.downloadingEnabled, | ||
94 | support: null, | 96 | support: null, |
95 | thumbnailUrl: null, | 97 | thumbnailUrl: null, |
96 | previewUrl: null | 98 | previewUrl: null |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 031e557ed..11db4a7ef 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts | |||
@@ -69,6 +69,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
69 | privacy: this.firstStepPrivacyId, | 69 | privacy: this.firstStepPrivacyId, |
70 | waitTranscoding: false, | 70 | waitTranscoding: false, |
71 | commentsEnabled: true, | 71 | commentsEnabled: true, |
72 | downloadingEnabled: true, | ||
72 | channelId: this.firstStepChannelId | 73 | channelId: this.firstStepChannelId |
73 | } | 74 | } |
74 | 75 | ||
@@ -83,6 +84,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
83 | 84 | ||
84 | this.video = new VideoEdit(Object.assign(res.video, { | 85 | this.video = new VideoEdit(Object.assign(res.video, { |
85 | commentsEnabled: videoUpdate.commentsEnabled, | 86 | commentsEnabled: videoUpdate.commentsEnabled, |
87 | downloadingEnabled: videoUpdate.downloadingEnabled, | ||
86 | support: null, | 88 | support: null, |
87 | thumbnailUrl: null, | 89 | thumbnailUrl: null, |
88 | previewUrl: null | 90 | previewUrl: null |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index 941dc5441..53f72f4e6 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -159,6 +159,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
159 | const nsfw = false | 159 | const nsfw = false |
160 | const waitTranscoding = true | 160 | const waitTranscoding = true |
161 | const commentsEnabled = true | 161 | const commentsEnabled = true |
162 | const downloadingEnabled = true | ||
162 | const channelId = this.firstStepChannelId.toString() | 163 | const channelId = this.firstStepChannelId.toString() |
163 | 164 | ||
164 | const formData = new FormData() | 165 | const formData = new FormData() |
@@ -167,6 +168,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
167 | formData.append('privacy', VideoPrivacy.PRIVATE.toString()) | 168 | formData.append('privacy', VideoPrivacy.PRIVATE.toString()) |
168 | formData.append('nsfw', '' + nsfw) | 169 | formData.append('nsfw', '' + nsfw) |
169 | formData.append('commentsEnabled', '' + commentsEnabled) | 170 | formData.append('commentsEnabled', '' + commentsEnabled) |
171 | formData.append('downloadingEnabled', '' + downloadingEnabled) | ||
170 | formData.append('waitTranscoding', '' + waitTranscoding) | 172 | formData.append('waitTranscoding', '' + waitTranscoding) |
171 | formData.append('channelId', '' + channelId) | 173 | formData.append('channelId', '' + channelId) |
172 | formData.append('videofile', videofile) | 174 | formData.append('videofile', videofile) |
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 770785d02..ba04d638f 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.html +++ b/client/src/app/videos/+video-watch/video-watch.component.html | |||
@@ -80,7 +80,7 @@ | |||
80 | </div> | 80 | </div> |
81 | 81 | ||
82 | <div ngbDropdownMenu> | 82 | <div ngbDropdownMenu> |
83 | <a class="dropdown-item" i18n-title title="Download the video" href="#" (click)="showDownloadModal($event)"> | 83 | <a *ngIf="isVideoDownloadable()" class="dropdown-item" i18n-title title="Download the video" href="#" (click)="showDownloadModal($event)"> |
84 | <span class="icon icon-download"></span> <ng-container i18n>Download</ng-container> | 84 | <span class="icon icon-download"></span> <ng-container i18n>Download</ng-container> |
85 | </a> | 85 | </a> |
86 | 86 | ||
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index c5deddf05..7cc831ab1 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -313,6 +313,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
313 | return this.video && this.video.state.id === VideoState.TO_TRANSCODE | 313 | return this.video && this.video.state.id === VideoState.TO_TRANSCODE |
314 | } | 314 | } |
315 | 315 | ||
316 | isVideoDownloadable () { | ||
317 | return this.video && this.video.downloadingEnabled | ||
318 | } | ||
319 | |||
316 | isVideoToImport () { | 320 | isVideoToImport () { |
317 | return this.video && this.video.state.id === VideoState.TO_IMPORT | 321 | return this.video && this.video.state.id === VideoState.TO_IMPORT |
318 | } | 322 | } |