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/src/app/shared/shared-main | |
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/src/app/shared/shared-main')
-rw-r--r-- | client/src/app/shared/shared-main/video/video.service.ts | 17 |
1 files changed, 11 insertions, 6 deletions
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) { |