aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.html2
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.ts4
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts11
3 files changed, 15 insertions, 2 deletions
diff --git a/client/src/app/+admin/overview/videos/video-list.component.html b/client/src/app/+admin/overview/videos/video-list.component.html
index 06b9ab347..14bbb55e9 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.html
+++ b/client/src/app/+admin/overview/videos/video-list.component.html
@@ -109,6 +109,7 @@
109 {{ file.resolution.label }}: {{ file.size | bytes: 1 }} 109 {{ file.resolution.label }}: {{ file.size | bytes: 1 }}
110 110
111 <my-global-icon 111 <my-global-icon
112 *ngIf="canRemoveOneFile(video)"
112 i18n-ngbTooltip ngbTooltip="Delete this file" iconName="delete" role="button" 113 i18n-ngbTooltip ngbTooltip="Delete this file" iconName="delete" role="button"
113 (click)="removeVideoFile(video, file, 'webtorrent')" 114 (click)="removeVideoFile(video, file, 'webtorrent')"
114 ></my-global-icon> 115 ></my-global-icon>
@@ -124,6 +125,7 @@
124 {{ file.resolution.label }}: {{ file.size | bytes: 1 }} 125 {{ file.resolution.label }}: {{ file.size | bytes: 1 }}
125 126
126 <my-global-icon 127 <my-global-icon
128 *ngIf="canRemoveOneFile(video)"
127 i18n-ngbTooltip ngbTooltip="Delete this file" iconName="delete" role="button" 129 i18n-ngbTooltip ngbTooltip="Delete this file" iconName="delete" role="button"
128 (click)="removeVideoFile(video, file, 'hls')" 130 (click)="removeVideoFile(video, file, 'hls')"
129 ></my-global-icon> 131 ></my-global-icon>
diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts
index ed7ec54a1..cb693ce12 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -166,6 +166,10 @@ export class VideoListComponent extends RestTable implements OnInit {
166 return video.files.length !== 0 166 return video.files.length !== 0
167 } 167 }
168 168
169 canRemoveOneFile (video: Video) {
170 return video.canRemoveOneFile(this.authUser)
171 }
172
169 getFilesSize (video: Video) { 173 getFilesSize (video: Video) {
170 let files = video.files 174 let files = video.files
171 175
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index 2e4ab87d7..c9c6b979c 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -1,8 +1,8 @@
1import { AuthUser } from '@app/core' 1import { AuthUser } from '@app/core'
2import { User } from '@app/core/users/user.model' 2import { User } from '@app/core/users/user.model'
3import { durationToString, prepareIcu, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers' 3import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl, prepareIcu } from '@app/helpers'
4import { Actor } from '@app/shared/shared-main/account/actor.model' 4import { Actor } from '@app/shared/shared-main/account/actor.model'
5import { buildVideoWatchPath } from '@shared/core-utils' 5import { buildVideoWatchPath, getAllFiles } from '@shared/core-utils'
6import { peertubeTranslate } from '@shared/core-utils/i18n' 6import { peertubeTranslate } from '@shared/core-utils/i18n'
7import { 7import {
8 ActorImage, 8 ActorImage,
@@ -240,6 +240,13 @@ export class Video implements VideoServerModel {
240 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.SEE_ALL_VIDEOS)) 240 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.SEE_ALL_VIDEOS))
241 } 241 }
242 242
243 canRemoveOneFile (user: AuthUser) {
244 return this.isLocal &&
245 user && user.hasRight(UserRight.MANAGE_VIDEO_FILES) &&
246 this.state.id !== VideoState.TO_TRANSCODE &&
247 getAllFiles(this).length > 1
248 }
249
243 canRemoveFiles (user: AuthUser) { 250 canRemoveFiles (user: AuthUser) {
244 return this.isLocal && 251 return this.isLocal &&
245 user && user.hasRight(UserRight.MANAGE_VIDEO_FILES) && 252 user && user.hasRight(UserRight.MANAGE_VIDEO_FILES) &&