aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/video-list/video-miniature.component.ts
blob: 28601ca7f06b10baa9ba96bea1b70cbdb9b74815 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Component, Input, Output, EventEmitter } from '@angular/core';

import { NotificationsService } from 'angular2-notifications';

import { ConfirmService, ConfigService } from '../../core';
import { SortField, Video, VideoService } from '../shared';
import { User } from '../../shared';

@Component({
  selector: 'my-video-miniature',
  styleUrls: [ './video-miniature.component.scss' ],
  templateUrl: './video-miniature.component.html'
})

export class VideoMiniatureComponent {
  @Input() currentSort: SortField;
  @Input() user: User;
  @Input() video: Video;

  constructor(
    private notificationsService: NotificationsService,
    private confirmService: ConfirmService,
    private configService: ConfigService,
    private videoService: VideoService
  ) {}

  getVideoName() {
    if (this.isVideoNSFWForThisUser())
      return 'NSFW';

    return this.video.name;
  }

  isVideoNSFWForThisUser() {
    return this.video.isVideoNSFWForUser(this.user);
  }
}