diff options
Diffstat (limited to 'client/src')
8 files changed, 77 insertions, 28 deletions
diff --git a/client/src/app/+accounts/account-about/account-about.component.ts b/client/src/app/+accounts/account-about/account-about.component.ts index 4086510ba..c0e793754 100644 --- a/client/src/app/+accounts/account-about/account-about.component.ts +++ b/client/src/app/+accounts/account-about/account-about.component.ts | |||
@@ -1,17 +1,20 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit, OnDestroy } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ActivatedRoute } from '@angular/router' |
3 | import { Account } from '@app/shared/account/account.model' | 3 | import { Account } from '@app/shared/account/account.model' |
4 | import { AccountService } from '@app/shared/account/account.service' | 4 | import { AccountService } from '@app/shared/account/account.service' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | import { Subscription } from 'rxjs' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-account-about', | 9 | selector: 'my-account-about', |
9 | templateUrl: './account-about.component.html', | 10 | templateUrl: './account-about.component.html', |
10 | styleUrls: [ './account-about.component.scss' ] | 11 | styleUrls: [ './account-about.component.scss' ] |
11 | }) | 12 | }) |
12 | export class AccountAboutComponent implements OnInit { | 13 | export class AccountAboutComponent implements OnInit, OnDestroy { |
13 | account: Account | 14 | account: Account |
14 | 15 | ||
16 | private accountSub: Subscription | ||
17 | |||
15 | constructor ( | 18 | constructor ( |
16 | private route: ActivatedRoute, | 19 | private route: ActivatedRoute, |
17 | private i18n: I18n, | 20 | private i18n: I18n, |
@@ -20,10 +23,14 @@ export class AccountAboutComponent implements OnInit { | |||
20 | 23 | ||
21 | ngOnInit () { | 24 | ngOnInit () { |
22 | // Parent get the account for us | 25 | // Parent get the account for us |
23 | this.accountService.accountLoaded | 26 | this.accountSub = this.accountService.accountLoaded |
24 | .subscribe(account => this.account = account) | 27 | .subscribe(account => this.account = account) |
25 | } | 28 | } |
26 | 29 | ||
30 | ngOnDestroy () { | ||
31 | if (this.accountSub) this.accountSub.unsubscribe() | ||
32 | } | ||
33 | |||
27 | getAccountDescription () { | 34 | getAccountDescription () { |
28 | if (this.account.description) return this.account.description | 35 | if (this.account.description) return this.account.description |
29 | 36 | ||
diff --git a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts index a6e6dd656..ebc671113 100644 --- a/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts +++ b/client/src/app/+accounts/account-video-channels/account-video-channels.component.ts | |||
@@ -1,20 +1,23 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ActivatedRoute } from '@angular/router' |
3 | import { Account } from '@app/shared/account/account.model' | 3 | import { Account } from '@app/shared/account/account.model' |
4 | import { AccountService } from '@app/shared/account/account.service' | 4 | import { AccountService } from '@app/shared/account/account.service' |
5 | import { VideoChannel } from '../../../../../shared/models/videos' | 5 | import { VideoChannel } from '../../../../../shared/models/videos' |
6 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 6 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
7 | import { flatMap, map, tap } from 'rxjs/operators' | 7 | import { flatMap, map, tap } from 'rxjs/operators' |
8 | import { Subscription } from 'rxjs' | ||
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-account-video-channels', | 11 | selector: 'my-account-video-channels', |
11 | templateUrl: './account-video-channels.component.html', | 12 | templateUrl: './account-video-channels.component.html', |
12 | styleUrls: [ './account-video-channels.component.scss' ] | 13 | styleUrls: [ './account-video-channels.component.scss' ] |
13 | }) | 14 | }) |
14 | export class AccountVideoChannelsComponent implements OnInit { | 15 | export class AccountVideoChannelsComponent implements OnInit, OnDestroy { |
15 | account: Account | 16 | account: Account |
16 | videoChannels: VideoChannel[] = [] | 17 | videoChannels: VideoChannel[] = [] |
17 | 18 | ||
19 | private accountSub: Subscription | ||
20 | |||
18 | constructor ( | 21 | constructor ( |
19 | protected route: ActivatedRoute, | 22 | protected route: ActivatedRoute, |
20 | private accountService: AccountService, | 23 | private accountService: AccountService, |
@@ -23,7 +26,7 @@ export class AccountVideoChannelsComponent implements OnInit { | |||
23 | 26 | ||
24 | ngOnInit () { | 27 | ngOnInit () { |
25 | // Parent get the account for us | 28 | // Parent get the account for us |
26 | this.accountService.accountLoaded | 29 | this.accountSub = this.accountService.accountLoaded |
27 | .pipe( | 30 | .pipe( |
28 | tap(account => this.account = account), | 31 | tap(account => this.account = account), |
29 | flatMap(account => this.videoChannelService.listAccountVideoChannels(account)), | 32 | flatMap(account => this.videoChannelService.listAccountVideoChannels(account)), |
@@ -31,4 +34,8 @@ export class AccountVideoChannelsComponent implements OnInit { | |||
31 | ) | 34 | ) |
32 | .subscribe(videoChannels => this.videoChannels = videoChannels) | 35 | .subscribe(videoChannels => this.videoChannels = videoChannels) |
33 | } | 36 | } |
37 | |||
38 | ngOnDestroy () { | ||
39 | if (this.accountSub) this.accountSub.unsubscribe() | ||
40 | } | ||
34 | } | 41 | } |
diff --git a/client/src/app/+accounts/account-videos/account-videos.component.ts b/client/src/app/+accounts/account-videos/account-videos.component.ts index 476f04024..5e3dbb6b3 100644 --- a/client/src/app/+accounts/account-videos/account-videos.component.ts +++ b/client/src/app/+accounts/account-videos/account-videos.component.ts | |||
@@ -11,6 +11,7 @@ import { Account } from '@app/shared/account/account.model' | |||
11 | import { AccountService } from '@app/shared/account/account.service' | 11 | import { AccountService } from '@app/shared/account/account.service' |
12 | import { tap } from 'rxjs/operators' | 12 | import { tap } from 'rxjs/operators' |
13 | import { I18n } from '@ngx-translate/i18n-polyfill' | 13 | import { I18n } from '@ngx-translate/i18n-polyfill' |
14 | import { Subscription } from 'rxjs' | ||
14 | 15 | ||
15 | @Component({ | 16 | @Component({ |
16 | selector: 'my-account-videos', | 17 | selector: 'my-account-videos', |
@@ -27,6 +28,7 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit, | |||
27 | loadOnInit = false | 28 | loadOnInit = false |
28 | 29 | ||
29 | private account: Account | 30 | private account: Account |
31 | private accountSub: Subscription | ||
30 | 32 | ||
31 | constructor ( | 33 | constructor ( |
32 | protected router: Router, | 34 | protected router: Router, |
@@ -48,17 +50,19 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit, | |||
48 | super.ngOnInit() | 50 | super.ngOnInit() |
49 | 51 | ||
50 | // Parent get the account for us | 52 | // Parent get the account for us |
51 | this.accountService.accountLoaded | 53 | this.accountSub = this.accountService.accountLoaded |
52 | .subscribe(account => { | 54 | .subscribe(account => { |
53 | this.account = account | 55 | this.account = account |
54 | this.currentRoute = '/account/' + this.account.id + '/videos' | 56 | this.currentRoute = '/account/' + this.account.nameWithHost + '/videos' |
55 | 57 | ||
56 | this.loadMoreVideos(this.pagination.currentPage) | 58 | this.reloadVideos() |
57 | this.generateSyndicationList() | 59 | this.generateSyndicationList() |
58 | }) | 60 | }) |
59 | } | 61 | } |
60 | 62 | ||
61 | ngOnDestroy () { | 63 | ngOnDestroy () { |
64 | if (this.accountSub) this.accountSub.unsubscribe() | ||
65 | |||
62 | super.ngOnDestroy() | 66 | super.ngOnDestroy() |
63 | } | 67 | } |
64 | 68 | ||
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index 24bde61ce..2a6856c10 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts | |||
@@ -3,7 +3,8 @@ import { ActivatedRoute } from '@angular/router' | |||
3 | import { AccountService } from '@app/shared/account/account.service' | 3 | import { AccountService } from '@app/shared/account/account.service' |
4 | import { Account } from '@app/shared/account/account.model' | 4 | import { Account } from '@app/shared/account/account.model' |
5 | import { RestExtractor } from '@app/shared' | 5 | import { RestExtractor } from '@app/shared' |
6 | import { catchError } from 'rxjs/operators' | 6 | import { catchError, switchMap, distinctUntilChanged, map } from 'rxjs/operators' |
7 | import { Subscription } from 'rxjs' | ||
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
9 | templateUrl: './accounts.component.html', | 10 | templateUrl: './accounts.component.html', |
@@ -12,6 +13,8 @@ import { catchError } from 'rxjs/operators' | |||
12 | export class AccountsComponent implements OnInit { | 13 | export class AccountsComponent implements OnInit { |
13 | account: Account | 14 | account: Account |
14 | 15 | ||
16 | private routeSub: Subscription | ||
17 | |||
15 | constructor ( | 18 | constructor ( |
16 | private route: ActivatedRoute, | 19 | private route: ActivatedRoute, |
17 | private accountService: AccountService, | 20 | private accountService: AccountService, |
@@ -19,10 +22,17 @@ export class AccountsComponent implements OnInit { | |||
19 | ) {} | 22 | ) {} |
20 | 23 | ||
21 | ngOnInit () { | 24 | ngOnInit () { |
22 | const accountId = this.route.snapshot.params['accountId'] | 25 | this.routeSub = this.route.params |
26 | .pipe( | ||
27 | map(params => params[ 'accountId' ]), | ||
28 | distinctUntilChanged(), | ||
29 | switchMap(accountId => this.accountService.getAccount(accountId)), | ||
30 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])) | ||
31 | ) | ||
32 | .subscribe(account => this.account = account) | ||
33 | } | ||
23 | 34 | ||
24 | this.accountService.getAccount(accountId) | 35 | ngOnDestroy () { |
25 | .pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ]))) | 36 | if (this.routeSub) this.routeSub.unsubscribe() |
26 | .subscribe(account => this.account = account) | ||
27 | } | 37 | } |
28 | } | 38 | } |
diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts index c5fd442c6..dc0893962 100644 --- a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts +++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts | |||
@@ -1,17 +1,20 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ActivatedRoute } from '@angular/router' |
3 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 3 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
4 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 4 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | import { Subscription } from 'rxjs' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-video-channel-about', | 9 | selector: 'my-video-channel-about', |
9 | templateUrl: './video-channel-about.component.html', | 10 | templateUrl: './video-channel-about.component.html', |
10 | styleUrls: [ './video-channel-about.component.scss' ] | 11 | styleUrls: [ './video-channel-about.component.scss' ] |
11 | }) | 12 | }) |
12 | export class VideoChannelAboutComponent implements OnInit { | 13 | export class VideoChannelAboutComponent implements OnInit, OnDestroy { |
13 | videoChannel: VideoChannel | 14 | videoChannel: VideoChannel |
14 | 15 | ||
16 | private videoChannelSub: Subscription | ||
17 | |||
15 | constructor ( | 18 | constructor ( |
16 | private route: ActivatedRoute, | 19 | private route: ActivatedRoute, |
17 | private i18n: I18n, | 20 | private i18n: I18n, |
@@ -20,10 +23,14 @@ export class VideoChannelAboutComponent implements OnInit { | |||
20 | 23 | ||
21 | ngOnInit () { | 24 | ngOnInit () { |
22 | // Parent get the video channel for us | 25 | // Parent get the video channel for us |
23 | this.videoChannelService.videoChannelLoaded | 26 | this.videoChannelSub = this.videoChannelService.videoChannelLoaded |
24 | .subscribe(videoChannel => this.videoChannel = videoChannel) | 27 | .subscribe(videoChannel => this.videoChannel = videoChannel) |
25 | } | 28 | } |
26 | 29 | ||
30 | ngOnDestroy () { | ||
31 | if (this.videoChannelSub) this.videoChannelSub.unsubscribe() | ||
32 | } | ||
33 | |||
27 | getVideoChannelDescription () { | 34 | getVideoChannelDescription () { |
28 | if (this.videoChannel.description) return this.videoChannel.description | 35 | if (this.videoChannel.description) return this.videoChannel.description |
29 | 36 | ||
diff --git a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts index 28c591039..2d3f66994 100644 --- a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts +++ b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts | |||
@@ -11,6 +11,7 @@ import { VideoChannelService } from '@app/shared/video-channel/video-channel.ser | |||
11 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 11 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
12 | import { tap } from 'rxjs/operators' | 12 | import { tap } from 'rxjs/operators' |
13 | import { I18n } from '@ngx-translate/i18n-polyfill' | 13 | import { I18n } from '@ngx-translate/i18n-polyfill' |
14 | import { Subscription } from 'rxjs' | ||
14 | 15 | ||
15 | @Component({ | 16 | @Component({ |
16 | selector: 'my-video-channel-videos', | 17 | selector: 'my-video-channel-videos', |
@@ -27,6 +28,7 @@ export class VideoChannelVideosComponent extends AbstractVideoList implements On | |||
27 | loadOnInit = false | 28 | loadOnInit = false |
28 | 29 | ||
29 | private videoChannel: VideoChannel | 30 | private videoChannel: VideoChannel |
31 | private videoChannelSub: Subscription | ||
30 | 32 | ||
31 | constructor ( | 33 | constructor ( |
32 | protected router: Router, | 34 | protected router: Router, |
@@ -48,17 +50,19 @@ export class VideoChannelVideosComponent extends AbstractVideoList implements On | |||
48 | super.ngOnInit() | 50 | super.ngOnInit() |
49 | 51 | ||
50 | // Parent get the video channel for us | 52 | // Parent get the video channel for us |
51 | this.videoChannelService.videoChannelLoaded | 53 | this.videoChannelSub = this.videoChannelService.videoChannelLoaded |
52 | .subscribe(videoChannel => { | 54 | .subscribe(videoChannel => { |
53 | this.videoChannel = videoChannel | 55 | this.videoChannel = videoChannel |
54 | this.currentRoute = '/video-channel/' + this.videoChannel.uuid + '/videos' | 56 | this.currentRoute = '/video-channel/' + this.videoChannel.uuid + '/videos' |
55 | 57 | ||
56 | this.loadMoreVideos(this.pagination.currentPage) | 58 | this.reloadVideos() |
57 | this.generateSyndicationList() | 59 | this.generateSyndicationList() |
58 | }) | 60 | }) |
59 | } | 61 | } |
60 | 62 | ||
61 | ngOnDestroy () { | 63 | ngOnDestroy () { |
64 | if (this.videoChannelSub) this.videoChannelSub.unsubscribe() | ||
65 | |||
62 | super.ngOnDestroy() | 66 | super.ngOnDestroy() |
63 | } | 67 | } |
64 | 68 | ||
diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts index 09541b370..cd0463859 100644 --- a/client/src/app/+video-channels/video-channels.component.ts +++ b/client/src/app/+video-channels/video-channels.component.ts | |||
@@ -1,28 +1,39 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit, OnDestroy } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ActivatedRoute } from '@angular/router' |
3 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 3 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
4 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 4 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
5 | import { RestExtractor } from '@app/shared' | 5 | import { RestExtractor } from '@app/shared' |
6 | import { catchError } from 'rxjs/operators' | 6 | import { catchError, switchMap, map, distinctUntilChanged } from 'rxjs/operators' |
7 | import { Subscription } from 'rxjs/Subscription' | ||
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
9 | templateUrl: './video-channels.component.html', | 10 | templateUrl: './video-channels.component.html', |
10 | styleUrls: [ './video-channels.component.scss' ] | 11 | styleUrls: [ './video-channels.component.scss' ] |
11 | }) | 12 | }) |
12 | export class VideoChannelsComponent implements OnInit { | 13 | export class VideoChannelsComponent implements OnInit, OnDestroy { |
13 | videoChannel: VideoChannel | 14 | videoChannel: VideoChannel |
14 | 15 | ||
16 | private routeSub: Subscription | ||
17 | |||
15 | constructor ( | 18 | constructor ( |
16 | private route: ActivatedRoute, | 19 | private route: ActivatedRoute, |
17 | private videoChannelService: VideoChannelService, | 20 | private videoChannelService: VideoChannelService, |
18 | private restExtractor: RestExtractor | 21 | private restExtractor: RestExtractor |
19 | ) {} | 22 | ) { } |
20 | 23 | ||
21 | ngOnInit () { | 24 | ngOnInit () { |
22 | const videoChannelId = this.route.snapshot.params['videoChannelId'] | 25 | this.routeSub = this.route.params |
26 | .pipe( | ||
27 | map(params => params[ 'videoChannelId' ]), | ||
28 | distinctUntilChanged(), | ||
29 | switchMap(videoChannelId => this.videoChannelService.getVideoChannel(videoChannelId)), | ||
30 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])) | ||
31 | ) | ||
32 | .subscribe(videoChannel => this.videoChannel = videoChannel) | ||
33 | |||
34 | } | ||
23 | 35 | ||
24 | this.videoChannelService.getVideoChannel(videoChannelId) | 36 | ngOnDestroy () { |
25 | .pipe(catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ]))) | 37 | if (this.routeSub) this.routeSub.unsubscribe() |
26 | .subscribe(videoChannel => this.videoChannel = videoChannel) | ||
27 | } | 38 | } |
28 | } | 39 | } |
diff --git a/client/src/app/videos/shared/markdown.service.ts b/client/src/app/videos/shared/markdown.service.ts index 9a36786b5..681140087 100644 --- a/client/src/app/videos/shared/markdown.service.ts +++ b/client/src/app/videos/shared/markdown.service.ts | |||
@@ -69,7 +69,6 @@ export class MarkdownService { | |||
69 | } | 69 | } |
70 | 70 | ||
71 | private avoidTruncatedLinks (html: string) { | 71 | private avoidTruncatedLinks (html: string) { |
72 | console.log(html) | ||
73 | return html.replace(/<a[^>]+>([^<]+)<\/a>\s*...((<\/p>)|(<\/li>)|(<\/strong>))?$/mi, '$1...') | 72 | return html.replace(/<a[^>]+>([^<]+)<\/a>\s*...((<\/p>)|(<\/li>)|(<\/strong>))?$/mi, '$1...') |
74 | } | 73 | } |
75 | } | 74 | } |