-import { Component, Input, OnInit } from '@angular/core'
+import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'
import { User } from '../users'
import { Video } from './video.model'
import { ServerService } from '@app/core'
+import { VideoPrivacy } from '../../../../../shared'
export type OwnerDisplayType = 'account' | 'videoChannel' | 'auto'
@Component({
selector: 'my-video-miniature',
styleUrls: [ './video-miniature.component.scss' ],
- templateUrl: './video-miniature.component.html'
+ templateUrl: './video-miniature.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush
})
export class VideoMiniatureComponent implements OnInit {
@Input() user: User
constructor (private serverService: ServerService) { }
+ get isVideoBlur () {
+ return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
+ }
+
ngOnInit () {
if (this.ownerDisplayType === 'account' || this.ownerDisplayType === 'videoChannel') {
this.ownerDisplayTypeChosen = this.ownerDisplayType
}
}
- isVideoBlur () {
- return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
- }
-
displayOwnerAccount () {
return this.ownerDisplayTypeChosen === 'account'
}
displayOwnerVideoChannel () {
return this.ownerDisplayTypeChosen === 'videoChannel'
}
+
+ isUnlistedVideo () {
+ return this.video.privacy.id === VideoPrivacy.UNLISTED
+ }
+
+ isPrivateVideo () {
+ return this.video.privacy.id === VideoPrivacy.PRIVATE
+ }
}