diff options
author | Chocobozzz <me@florianbigard.com> | 2019-05-21 09:34:02 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-05-21 09:34:02 +0200 |
commit | fd822c1c699fb89bb1c3218e047e1d842bc1ba1a (patch) | |
tree | 4f7e81261f2dc07aa75a83e97f25da1f11e146ea /client/src/app/shared | |
parent | b5bfadf0b5365481179936fd3058134fd8be8e18 (diff) | |
parent | 4550872bcc8f9ef46183463c7b7b74a90cb6d17c (diff) | |
download | PeerTube-fd822c1c699fb89bb1c3218e047e1d842bc1ba1a.tar.gz PeerTube-fd822c1c699fb89bb1c3218e047e1d842bc1ba1a.tar.zst PeerTube-fd822c1c699fb89bb1c3218e047e1d842bc1ba1a.zip |
Merge branch 'release/v1.3.0' into develop
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/video-playlist/video-add-to-playlist.component.ts | 26 | ||||
-rw-r--r-- | client/src/app/shared/video/video-actions-dropdown.component.ts | 5 |
2 files changed, 27 insertions, 4 deletions
diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts index 7dcdf7a9e..be15f2352 100644 --- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts +++ b/client/src/app/shared/video-playlist/video-add-to-playlist.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core' | 1 | import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
2 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 2 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
3 | import { AuthService, Notifier } from '@app/core' | 3 | import { AuthService, Notifier } from '@app/core' |
4 | import { forkJoin } from 'rxjs' | 4 | import { forkJoin } from 'rxjs' |
@@ -22,7 +22,7 @@ type PlaylistSummary = { | |||
22 | templateUrl: './video-add-to-playlist.component.html', | 22 | templateUrl: './video-add-to-playlist.component.html', |
23 | changeDetection: ChangeDetectionStrategy.OnPush | 23 | changeDetection: ChangeDetectionStrategy.OnPush |
24 | }) | 24 | }) |
25 | export class VideoAddToPlaylistComponent extends FormReactive implements OnInit { | 25 | export class VideoAddToPlaylistComponent extends FormReactive implements OnInit, OnChanges { |
26 | @Input() video: Video | 26 | @Input() video: Video |
27 | @Input() currentVideoTimestamp: number | 27 | @Input() currentVideoTimestamp: number |
28 | @Input() lazyLoad = false | 28 | @Input() lazyLoad = false |
@@ -54,15 +54,33 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit | |||
54 | } | 54 | } |
55 | 55 | ||
56 | ngOnInit () { | 56 | ngOnInit () { |
57 | this.resetOptions(true) | ||
58 | |||
59 | this.buildForm({ | 57 | this.buildForm({ |
60 | displayName: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DISPLAY_NAME | 58 | displayName: this.videoPlaylistValidatorsService.VIDEO_PLAYLIST_DISPLAY_NAME |
61 | }) | 59 | }) |
62 | 60 | ||
61 | this.init() | ||
62 | } | ||
63 | |||
64 | ngOnChanges (simpleChanges: SimpleChanges) { | ||
65 | if (simpleChanges['video']) { | ||
66 | this.unload() | ||
67 | } | ||
68 | } | ||
69 | |||
70 | init () { | ||
71 | this.resetOptions(true) | ||
72 | |||
63 | if (this.lazyLoad !== true) this.load() | 73 | if (this.lazyLoad !== true) this.load() |
64 | } | 74 | } |
65 | 75 | ||
76 | unload () { | ||
77 | this.videoPlaylists = [] | ||
78 | |||
79 | this.init() | ||
80 | |||
81 | this.cd.markForCheck() | ||
82 | } | ||
83 | |||
66 | load () { | 84 | load () { |
67 | forkJoin([ | 85 | forkJoin([ |
68 | this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'), | 86 | this.videoPlaylistService.listAccountPlaylists(this.user.account, '-updatedAt'), |
diff --git a/client/src/app/shared/video/video-actions-dropdown.component.ts b/client/src/app/shared/video/video-actions-dropdown.component.ts index ee2f44f9e..df799499e 100644 --- a/client/src/app/shared/video/video-actions-dropdown.component.ts +++ b/client/src/app/shared/video/video-actions-dropdown.component.ts | |||
@@ -79,6 +79,11 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | ngOnChanges () { | 81 | ngOnChanges () { |
82 | if (this.loaded) { | ||
83 | this.loaded = false | ||
84 | this.playlistAdd.unload() | ||
85 | } | ||
86 | |||
82 | this.buildActions() | 87 | this.buildActions() |
83 | } | 88 | } |
84 | 89 | ||