Fix autoblock message on upload page

This commit is contained in:
Chocobozzz 2021-10-08 11:26:17 +02:00
parent 9da443f374
commit 8e7442d0d8
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 6 additions and 3 deletions

View File

@ -15,7 +15,7 @@
</ng-container>
<ng-container *ngIf="!user.isUploadDisabled()">
<div *ngIf="user.isAutoBlocked()" class="upload-message auto-blocked alert alert-warning">
<div *ngIf="user.isAutoBlocked(serverConfig)" class="upload-message auto-blocked alert alert-warning">
<div>{{ uploadMessages.autoBlock }}</div>
<ng-template [ngTemplateOutlet]="AlertButtons" *ngIf="!hasNoQuotaLeft && !hasNoQuotaLeftDaily"></ng-template>
</div>

View File

@ -43,7 +43,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
hasNoQuotaLeft = false
hasNoQuotaLeftDaily = false
private serverConfig: HTMLServerConfig
serverConfig: HTMLServerConfig
constructor (
private auth: AuthService,

View File

@ -2,6 +2,7 @@ import { Account } from '@app/shared/shared-main/account/account.model'
import { hasUserRight } from '@shared/core-utils/users'
import {
ActorImage,
HTMLServerConfig,
NSFWPolicyType,
User as UserServerModel,
UserAdminFlag,
@ -136,7 +137,9 @@ export class User implements UserServerModel {
return this.videoQuota === 0 || this.videoQuotaDaily === 0
}
isAutoBlocked () {
isAutoBlocked (serverConfig: HTMLServerConfig) {
if (serverConfig.autoBlacklist.videos.ofUsers.enabled !== true) return false
return this.role === UserRole.USER && this.adminFlags !== UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
}
}