diff options
author | Kim <1877318+kimsible@users.noreply.github.com> | 2020-07-28 15:18:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-28 15:18:38 +0200 |
commit | dfe3f7b72ef46401206f6f461077a7984a0c72f0 (patch) | |
tree | 775a747f2dd4bc098afc2ec254792e2e8e8cbbb4 /client/src/app/+videos/+video-edit/video-add.component.ts | |
parent | 0579dee3b29e301838387f53b91b58bff2ffb19a (diff) | |
download | PeerTube-dfe3f7b72ef46401206f6f461077a7984a0c72f0.tar.gz PeerTube-dfe3f7b72ef46401206f6f461077a7984a0c72f0.tar.zst PeerTube-dfe3f7b72ef46401206f6f461077a7984a0c72f0.zip |
Add alert and hide upload view when no upload is possible (#2966)
* Add alert and hide upload view when no upload is possible
* Add about instance link to alert
* Hide videos and imports links when no upload is possible
* Correct curly spacing lint
* Put logic canUpload to User model + add isHidden param to to-menu-dropdown
* Use canSeeVideoLinks from user model
* Rename and change logic canUpload to isUploadDisabled
* Use isDisplayed() method intead of isHidden value
* Refactor client and check videos count using quota
Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Co-authored-by: Chocobozzz <me@florianbigard.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 | 8 |
1 files changed, 5 insertions, 3 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 016791d59..94e85efc1 100644 --- a/client/src/app/+videos/+video-edit/video-add.component.ts +++ b/client/src/app/+videos/+video-edit/video-add.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, HostListener, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, HostListener, OnInit, ViewChild } from '@angular/core' |
2 | import { AuthService, CanComponentDeactivate, ServerService, User } from '@app/core' | 2 | import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core' |
3 | import { ServerConfig } from '@shared/models' | 3 | import { ServerConfig } from '@shared/models' |
4 | import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' | 4 | import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' |
5 | import { VideoImportUrlComponent } from './video-add-components/video-import-url.component' | 5 | import { VideoImportUrlComponent } from './video-add-components/video-import-url.component' |
@@ -15,7 +15,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate { | |||
15 | @ViewChild('videoImportUrl') videoImportUrl: VideoImportUrlComponent | 15 | @ViewChild('videoImportUrl') videoImportUrl: VideoImportUrlComponent |
16 | @ViewChild('videoImportTorrent') videoImportTorrent: VideoImportTorrentComponent | 16 | @ViewChild('videoImportTorrent') videoImportTorrent: VideoImportTorrentComponent |
17 | 17 | ||
18 | user: User = null | 18 | user: AuthUser = null |
19 | 19 | ||
20 | secondStepType: 'upload' | 'import-url' | 'import-torrent' | 20 | secondStepType: 'upload' | 'import-url' | 'import-torrent' |
21 | videoName: string | 21 | videoName: string |
@@ -37,6 +37,8 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate { | |||
37 | 37 | ||
38 | this.serverService.getConfig() | 38 | this.serverService.getConfig() |
39 | .subscribe(config => this.serverConfig = config) | 39 | .subscribe(config => this.serverConfig = config) |
40 | |||
41 | this.user = this.auth.getUser() | ||
40 | } | 42 | } |
41 | 43 | ||
42 | onFirstStepDone (type: 'upload' | 'import-url' | 'import-torrent', videoName: string) { | 44 | onFirstStepDone (type: 'upload' | 'import-url' | 'import-torrent', videoName: string) { |
@@ -80,6 +82,6 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate { | |||
80 | } | 82 | } |
81 | 83 | ||
82 | isRootUser () { | 84 | isRootUser () { |
83 | return this.auth.getUser().username === 'root' | 85 | return this.user.username === 'root' |
84 | } | 86 | } |
85 | } | 87 | } |