From 367a9dc69975a0db01962dbb7106635fb8eb1696 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 13 Sep 2022 12:00:13 +0200 Subject: Don't display remove file icon in some cases --- client/src/app/shared/shared-main/video/video.model.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared/shared-main/video/video.model.ts') 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 @@ import { AuthUser } from '@app/core' import { User } from '@app/core/users/user.model' -import { durationToString, prepareIcu, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers' +import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl, prepareIcu } from '@app/helpers' import { Actor } from '@app/shared/shared-main/account/actor.model' -import { buildVideoWatchPath } from '@shared/core-utils' +import { buildVideoWatchPath, getAllFiles } from '@shared/core-utils' import { peertubeTranslate } from '@shared/core-utils/i18n' import { ActorImage, @@ -240,6 +240,13 @@ export class Video implements VideoServerModel { return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.SEE_ALL_VIDEOS)) } + canRemoveOneFile (user: AuthUser) { + return this.isLocal && + user && user.hasRight(UserRight.MANAGE_VIDEO_FILES) && + this.state.id !== VideoState.TO_TRANSCODE && + getAllFiles(this).length > 1 + } + canRemoveFiles (user: AuthUser) { return this.isLocal && user && user.hasRight(UserRight.MANAGE_VIDEO_FILES) && -- cgit v1.2.3