]>
Commit | Line | Data |
---|---|---|
df98563e | 1 | import { Component, Input, Output, EventEmitter } from '@angular/core' |
501bc6c2 | 2 | |
df98563e | 3 | import { NotificationsService } from 'angular2-notifications' |
7ddd02c9 | 4 | |
df98563e C |
5 | import { ConfirmService, ConfigService } from '../../core' |
6 | import { SortField, Video, VideoService } from '../shared' | |
7 | import { User } from '../../shared' | |
501bc6c2 C |
8 | |
9 | @Component({ | |
10 | selector: 'my-video-miniature', | |
ec8d8440 C |
11 | styleUrls: [ './video-miniature.component.scss' ], |
12 | templateUrl: './video-miniature.component.html' | |
501bc6c2 C |
13 | }) |
14 | ||
15 | export class VideoMiniatureComponent { | |
df98563e C |
16 | @Input() currentSort: SortField |
17 | @Input() user: User | |
18 | @Input() video: Video | |
501bc6c2 | 19 | |
df98563e | 20 | constructor ( |
7ddd02c9 | 21 | private notificationsService: NotificationsService, |
5769e1db | 22 | private confirmService: ConfirmService, |
92fb909c | 23 | private configService: ConfigService, |
7ddd02c9 C |
24 | private videoService: VideoService |
25 | ) {} | |
501bc6c2 | 26 | |
df98563e C |
27 | getVideoName () { |
28 | if (this.isVideoNSFWForThisUser()) { | |
29 | return 'NSFW' | |
30 | } | |
92fb909c | 31 | |
df98563e | 32 | return this.video.name |
92fb909c C |
33 | } |
34 | ||
df98563e C |
35 | isVideoNSFWForThisUser () { |
36 | return this.video.isVideoNSFWForUser(this.user) | |
92fb909c | 37 | } |
501bc6c2 | 38 | } |