diff options
author | Ms Kimsible <1877318+kimsible@users.noreply.github.com> | 2021-08-25 11:38:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 11:38:10 +0200 |
commit | 4e1592daa41f81667f914f37d36795e8c6c046c3 (patch) | |
tree | 8bed3af237b6d5d4da08af989c3824a168e6f3b6 /client/src/app/+videos/+video-edit/video-add.component.ts | |
parent | 644800ef5588e08da2a8227f6d72751d3dca85db (diff) | |
download | PeerTube-4e1592daa41f81667f914f37d36795e8c6c046c3.tar.gz PeerTube-4e1592daa41f81667f914f37d36795e8c6c046c3.tar.zst PeerTube-4e1592daa41f81667f914f37d36795e8c6c046c3.zip |
Alert user for low quota and video auto-block on upload page (#4336)
* Replace wording of instance contact
* Add contact-us button to no-quota alert on upload page
* Add alert for accounts with auto-blocked videos on upload page
* Add alert for accounts without enough quota + refacto on upload page
* Using ng-container and ng-template
* Add alert for daily quota
* Add hook filter for upload page alert messages
* Add instance name as subtitle in contact modal
* Fix eslint max-len on string
* Fix missing word in quota left daily message - upload page
Co-authored-by: Kimsible <kimsible@users.noreply.github.com>
Diffstat (limited to 'client/src/app/+videos/+video-edit/video-add.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-edit/video-add.component.ts | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add.component.ts b/client/src/app/+videos/+video-edit/video-add.component.ts index 8606b8222..1443c64af 100644 --- a/client/src/app/+videos/+video-edit/video-add.component.ts +++ b/client/src/app/+videos/+video-edit/video-add.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, HostListener, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, HostListener, OnInit, ViewChild } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core' | 3 | import { AuthService, AuthUser, CanComponentDeactivate, HooksService, ServerService } from '@app/core' |
4 | import { HTMLServerConfig } from '@shared/models' | 4 | import { HTMLServerConfig } from '@shared/models' |
5 | import { VideoEditType } from './shared/video-edit.type' | 5 | import { VideoEditType } from './shared/video-edit.type' |
6 | import { VideoGoLiveComponent } from './video-add-components/video-go-live.component' | 6 | import { VideoGoLiveComponent } from './video-add-components/video-go-live.component' |
@@ -26,15 +26,27 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate { | |||
26 | 26 | ||
27 | activeNav: string | 27 | activeNav: string |
28 | 28 | ||
29 | uploadMessages: { | ||
30 | noQuota: string | ||
31 | autoBlock: string | ||
32 | quotaLeftDaily: string | ||
33 | quotaLeft: string | ||
34 | } | ||
35 | |||
29 | private serverConfig: HTMLServerConfig | 36 | private serverConfig: HTMLServerConfig |
30 | 37 | ||
31 | constructor ( | 38 | constructor ( |
32 | private auth: AuthService, | 39 | private auth: AuthService, |
40 | private hooks: HooksService, | ||
33 | private serverService: ServerService, | 41 | private serverService: ServerService, |
34 | private route: ActivatedRoute, | 42 | private route: ActivatedRoute, |
35 | private router: Router | 43 | private router: Router |
36 | ) {} | 44 | ) {} |
37 | 45 | ||
46 | get isContactFormEnabled () { | ||
47 | return this.serverConfig.email.enabled && this.serverConfig.contactForm.enabled | ||
48 | } | ||
49 | |||
38 | get userInformationLoaded () { | 50 | get userInformationLoaded () { |
39 | return this.auth.userInformationLoaded | 51 | return this.auth.userInformationLoaded |
40 | } | 52 | } |
@@ -49,6 +61,28 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate { | |||
49 | if (this.route.snapshot.fragment) { | 61 | if (this.route.snapshot.fragment) { |
50 | this.onNavChange(this.route.snapshot.fragment) | 62 | this.onNavChange(this.route.snapshot.fragment) |
51 | } | 63 | } |
64 | |||
65 | this.buildUploadMessages() | ||
66 | } | ||
67 | |||
68 | private async buildUploadMessages () { | ||
69 | // eslint-disable-next-line max-len | ||
70 | const noQuota = $localize`Sorry, the upload feature is disabled for your account. If you want to add videos, an admin must unlock your quota.` | ||
71 | // eslint-disable-next-line max-len | ||
72 | const autoBlock = $localize`Uploaded videos are reviewed before publishing for your account. If you want to add videos without moderation review, an admin must turn off your videos auto-block.` | ||
73 | // eslint-disable-next-line max-len | ||
74 | const quotaLeftDaily = $localize`Your daily video quota is insufficient. If you want to add more videos, you must wait for 24 hours or an admin must increase your daily quota.` | ||
75 | // eslint-disable-next-line max-len | ||
76 | const quotaLeft = $localize`Your video quota is insufficient. If you want to add more videos, an admin must increase your quota.` | ||
77 | |||
78 | const uploadMessages = { | ||
79 | noQuota, | ||
80 | autoBlock, | ||
81 | quotaLeftDaily, | ||
82 | quotaLeft | ||
83 | } | ||
84 | |||
85 | this.uploadMessages = await this.hooks.wrapObject(uploadMessages, 'common', 'filter:upload-page.alert-messages.edit.result') | ||
52 | } | 86 | } |
53 | 87 | ||
54 | onNavChange (newActiveNav: string) { | 88 | onNavChange (newActiveNav: string) { |