diff options
author | Chocobozzz <me@florianbigard.com> | 2020-07-27 11:40:30 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-07-31 11:35:19 +0200 |
commit | 94148c9028829b5576a5dcbfba2c7fb9cf6443d3 (patch) | |
tree | 2774f272329111abd03e8441ff936da11fb1a3f3 /client/src/app/shared/shared-abuse-list/abuse-details.component.ts | |
parent | 441e453ae53e491b09c9b09b00b041788176ce64 (diff) | |
download | PeerTube-94148c9028829b5576a5dcbfba2c7fb9cf6443d3.tar.gz PeerTube-94148c9028829b5576a5dcbfba2c7fb9cf6443d3.tar.zst PeerTube-94148c9028829b5576a5dcbfba2c7fb9cf6443d3.zip |
Add abuse messages management in my account
Diffstat (limited to 'client/src/app/shared/shared-abuse-list/abuse-details.component.ts')
-rw-r--r-- | client/src/app/shared/shared-abuse-list/abuse-details.component.ts | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-abuse-list/abuse-details.component.ts b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts new file mode 100644 index 000000000..cdd4bf2c8 --- /dev/null +++ b/client/src/app/shared/shared-abuse-list/abuse-details.component.ts | |||
@@ -0,0 +1,55 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { durationToString } from '@app/helpers' | ||
3 | import { Actor } from '@app/shared/shared-main' | ||
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | import { AbusePredefinedReasonsString } from '@shared/models' | ||
6 | import { ProcessedAbuse } from './processed-abuse.model' | ||
7 | |||
8 | @Component({ | ||
9 | selector: 'my-abuse-details', | ||
10 | templateUrl: './abuse-details.component.html', | ||
11 | styleUrls: [ '../shared-moderation/moderation.scss', './abuse-details.component.scss' ] | ||
12 | }) | ||
13 | export class AbuseDetailsComponent { | ||
14 | @Input() abuse: ProcessedAbuse | ||
15 | @Input() isAdminView: boolean | ||
16 | @Input() baseRoute: string | ||
17 | |||
18 | private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string } | ||
19 | |||
20 | constructor ( | ||
21 | private i18n: I18n | ||
22 | ) { | ||
23 | this.predefinedReasonsTranslations = { | ||
24 | violentOrRepulsive: this.i18n('Violent or Repulsive'), | ||
25 | hatefulOrAbusive: this.i18n('Hateful or Abusive'), | ||
26 | spamOrMisleading: this.i18n('Spam or Misleading'), | ||
27 | privacy: this.i18n('Privacy'), | ||
28 | rights: this.i18n('Rights'), | ||
29 | serverRules: this.i18n('Server rules'), | ||
30 | thumbnails: this.i18n('Thumbnails'), | ||
31 | captions: this.i18n('Captions') | ||
32 | } | ||
33 | } | ||
34 | |||
35 | get startAt () { | ||
36 | return durationToString(this.abuse.video.startAt) | ||
37 | } | ||
38 | |||
39 | get endAt () { | ||
40 | return durationToString(this.abuse.video.endAt) | ||
41 | } | ||
42 | |||
43 | getPredefinedReasons () { | ||
44 | if (!this.abuse.predefinedReasons) return [] | ||
45 | |||
46 | return this.abuse.predefinedReasons.map(r => ({ | ||
47 | id: r, | ||
48 | label: this.predefinedReasonsTranslations[r] | ||
49 | })) | ||
50 | } | ||
51 | |||
52 | switchToDefaultAvatar ($event: Event) { | ||
53 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | ||
54 | } | ||
55 | } | ||