Fix autoblock message on upload page

This commit is contained in:
Chocobozzz 2021-10-08 11:26:17 +02:00
parent ab7b4f525b
commit e0b1231b20
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>
<ng-container *ngIf="!user.isUploadDisabled()"> <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> <div>{{ uploadMessages.autoBlock }}</div>
<ng-template [ngTemplateOutlet]="AlertButtons" *ngIf="!hasNoQuotaLeft && !hasNoQuotaLeftDaily"></ng-template> <ng-template [ngTemplateOutlet]="AlertButtons" *ngIf="!hasNoQuotaLeft && !hasNoQuotaLeftDaily"></ng-template>
</div> </div>

View File

@ -43,7 +43,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
hasNoQuotaLeft = false hasNoQuotaLeft = false
hasNoQuotaLeftDaily = false hasNoQuotaLeftDaily = false
private serverConfig: HTMLServerConfig serverConfig: HTMLServerConfig
constructor ( constructor (
private auth: AuthService, 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 { hasUserRight } from '@shared/core-utils/users'
import { import {
ActorImage, ActorImage,
HTMLServerConfig,
NSFWPolicyType, NSFWPolicyType,
User as UserServerModel, User as UserServerModel,
UserAdminFlag, UserAdminFlag,
@ -136,7 +137,9 @@ export class User implements UserServerModel {
return this.videoQuota === 0 || this.videoQuotaDaily === 0 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 return this.role === UserRole.USER && this.adminFlags !== UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
} }
} }