diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-06-05 11:05:25 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-08 09:22:06 +0200 |
commit | 295106516277581ba4967199fa5580264a90ae2c (patch) | |
tree | 1e95f4ba0f4c354802a495939d642590a5d3b5fa /client | |
parent | 27bc95867442c772841fb183a625bbda61dede51 (diff) | |
download | PeerTube-295106516277581ba4967199fa5580264a90ae2c.tar.gz PeerTube-295106516277581ba4967199fa5580264a90ae2c.tar.zst PeerTube-295106516277581ba4967199fa5580264a90ae2c.zip |
allow public video privacy to be deleted in the web client
Diffstat (limited to 'client')
7 files changed, 15 insertions, 17 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index c3299cade..aebd53318 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts | |||
@@ -184,7 +184,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
184 | 184 | ||
185 | this.serverService.getVideoPrivacies() | 185 | this.serverService.getVideoPrivacies() |
186 | .subscribe(privacies => { | 186 | .subscribe(privacies => { |
187 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies) | 187 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies |
188 | if (this.schedulePublicationPossible) { | 188 | if (this.schedulePublicationPossible) { |
189 | this.videoPrivacies.push({ | 189 | this.videoPrivacies.push({ |
190 | id: this.SPECIAL_SCHEDULED_PRIVACY, | 190 | id: this.SPECIAL_SCHEDULED_PRIVACY, |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts index 15178a267..4c39b276a 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | |||
@@ -30,8 +30,6 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
30 | videoUUID: string | 30 | videoUUID: string |
31 | error: string | 31 | error: string |
32 | 32 | ||
33 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC | ||
34 | |||
35 | constructor ( | 33 | constructor ( |
36 | protected formValidatorService: FormValidatorService, | 34 | protected formValidatorService: FormValidatorService, |
37 | protected loadingBar: LoadingBarService, | 35 | protected loadingBar: LoadingBarService, |
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 2837b30c1..172dd5ba5 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 | |||
@@ -32,8 +32,6 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af | |||
32 | video: VideoEdit | 32 | video: VideoEdit |
33 | error: string | 33 | error: string |
34 | 34 | ||
35 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC | ||
36 | |||
37 | constructor ( | 35 | constructor ( |
38 | protected formValidatorService: FormValidatorService, | 36 | protected formValidatorService: FormValidatorService, |
39 | protected loadingBar: LoadingBarService, | 37 | protected loadingBar: LoadingBarService, |
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 7a9fe369f..2994d05fa 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 | |||
@@ -31,8 +31,6 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV | |||
31 | video: VideoEdit | 31 | video: VideoEdit |
32 | error: string | 32 | error: string |
33 | 33 | ||
34 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC | ||
35 | |||
36 | constructor ( | 34 | constructor ( |
37 | protected formValidatorService: FormValidatorService, | 35 | protected formValidatorService: FormValidatorService, |
38 | protected loadingBar: LoadingBarService, | 36 | protected loadingBar: LoadingBarService, |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts index a185892fe..0e7a26a47 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts | |||
@@ -20,7 +20,6 @@ export abstract class VideoSend extends FormReactive implements OnInit { | |||
20 | 20 | ||
21 | abstract firstStepDone: EventEmitter<string> | 21 | abstract firstStepDone: EventEmitter<string> |
22 | abstract firstStepError: EventEmitter<void> | 22 | abstract firstStepError: EventEmitter<void> |
23 | protected abstract readonly DEFAULT_VIDEO_PRIVACY: VideoPrivacy | ||
24 | 23 | ||
25 | protected loadingBar: LoadingBarService | 24 | protected loadingBar: LoadingBarService |
26 | protected notifier: Notifier | 25 | protected notifier: Notifier |
@@ -46,9 +45,10 @@ export abstract class VideoSend extends FormReactive implements OnInit { | |||
46 | this.serverService.getVideoPrivacies() | 45 | this.serverService.getVideoPrivacies() |
47 | .subscribe( | 46 | .subscribe( |
48 | privacies => { | 47 | privacies => { |
49 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies) | 48 | const { videoPrivacies, defaultPrivacyId } = this.videoService.explainedPrivacyLabels(privacies) |
50 | 49 | ||
51 | this.firstStepPrivacyId = this.DEFAULT_VIDEO_PRIVACY | 50 | this.videoPrivacies = videoPrivacies |
51 | this.firstStepPrivacyId = defaultPrivacyId | ||
52 | }) | 52 | }) |
53 | } | 53 | } |
54 | 54 | ||
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 e20f08879..f383662a1 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 | |||
@@ -46,7 +46,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
46 | enableRetryAfterError: boolean | 46 | enableRetryAfterError: boolean |
47 | 47 | ||
48 | // So that it can be accessed in the template | 48 | // So that it can be accessed in the template |
49 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC | ||
50 | protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + 'upload-resumable' | 49 | protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + 'upload-resumable' |
51 | 50 | ||
52 | private uploadxOptions: UploadxOptions | 51 | private uploadxOptions: UploadxOptions |
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 7b17bd2ab..1410edd18 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { Observable, of, throwError } from 'rxjs' | 1 | import { Observable } from 'rxjs' |
2 | import { catchError, map, mergeMap, switchMap } from 'rxjs/operators' | 2 | import { catchError, map, switchMap } from 'rxjs/operators' |
3 | import { HttpClient, HttpErrorResponse, HttpParams, HttpRequest } from '@angular/common/http' | 3 | import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
5 | import { ComponentPaginationLight, RestExtractor, RestService, ServerService, UserService, AuthService } from '@app/core' | 5 | import { ComponentPaginationLight, RestExtractor, RestService, ServerService, UserService } from '@app/core' |
6 | import { objectToFormData } from '@app/helpers' | 6 | import { objectToFormData } from '@app/helpers' |
7 | import { | 7 | import { |
8 | FeedFormat, | 8 | FeedFormat, |
@@ -378,7 +378,7 @@ export class VideoService implements VideosProvider { | |||
378 | ) | 378 | ) |
379 | } | 379 | } |
380 | 380 | ||
381 | explainedPrivacyLabels (privacies: VideoConstant<VideoPrivacy>[]) { | 381 | explainedPrivacyLabels (privacies: VideoConstant<VideoPrivacy>[], defaultPrivacyId = VideoPrivacy.PUBLIC) { |
382 | const base = [ | 382 | const base = [ |
383 | { | 383 | { |
384 | id: VideoPrivacy.PRIVATE, | 384 | id: VideoPrivacy.PRIVATE, |
@@ -398,9 +398,14 @@ export class VideoService implements VideosProvider { | |||
398 | } | 398 | } |
399 | ] | 399 | ] |
400 | 400 | ||
401 | return base | 401 | const videoPrivacies = base |
402 | .filter(o => !!privacies.find(p => p.id === o.id)) // filter down to privacies that where in the input | 402 | .filter(o => !!privacies.find(p => p.id === o.id)) // filter down to privacies that where in the input |
403 | .map(o => ({ ...privacies[o.id - 1], ...o })) // merge the input privacies that contain a label, and extend them with a description | 403 | .map(o => ({ ...privacies[o.id - 1], ...o })) // merge the input privacies that contain a label, and extend them with a description |
404 | |||
405 | return { | ||
406 | defaultPrivacyId: videoPrivacies.find(p => p.id === defaultPrivacyId)?.id || videoPrivacies[0].id, | ||
407 | videoPrivacies | ||
408 | } | ||
404 | } | 409 | } |
405 | 410 | ||
406 | nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType) { | 411 | nsfwPolicyToParam (nsfwPolicy: NSFWPolicyType) { |