diff options
Diffstat (limited to 'client/src/app/+accounts/accounts.component.ts')
-rw-r--r-- | client/src/app/+accounts/accounts.component.ts | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index 733cff8d5..e90816c5a 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Subscription } from 'rxjs' | 1 | import { Subscription } from 'rxjs' |
2 | import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators' | 2 | import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators' |
3 | import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core' | 3 | import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core' |
4 | import { ActivatedRoute } from '@angular/router' | 4 | import { ActivatedRoute, Router } from '@angular/router' |
5 | import { AuthService, MarkdownService, Notifier, RedirectService, RestExtractor, ScreenService, UserService } from '@app/core' | 5 | import { AuthService, MarkdownService, Notifier, RedirectService, RestExtractor, ScreenService, UserService } from '@app/core' |
6 | import { | 6 | import { |
7 | Account, | 7 | Account, |
@@ -14,7 +14,6 @@ import { | |||
14 | } from '@app/shared/shared-main' | 14 | } from '@app/shared/shared-main' |
15 | import { AccountReportComponent } from '@app/shared/shared-moderation' | 15 | import { AccountReportComponent } from '@app/shared/shared-moderation' |
16 | import { HttpStatusCode, User, UserRight } from '@shared/models' | 16 | import { HttpStatusCode, User, UserRight } from '@shared/models' |
17 | import { AccountSearchComponent } from './account-search/account-search.component' | ||
18 | 17 | ||
19 | @Component({ | 18 | @Component({ |
20 | templateUrl: './accounts.component.html', | 19 | templateUrl: './accounts.component.html', |
@@ -23,8 +22,6 @@ import { AccountSearchComponent } from './account-search/account-search.componen | |||
23 | export class AccountsComponent implements OnInit, OnDestroy { | 22 | export class AccountsComponent implements OnInit, OnDestroy { |
24 | @ViewChild('accountReportModal') accountReportModal: AccountReportComponent | 23 | @ViewChild('accountReportModal') accountReportModal: AccountReportComponent |
25 | 24 | ||
26 | accountSearch: AccountSearchComponent | ||
27 | |||
28 | account: Account | 25 | account: Account |
29 | accountUser: User | 26 | accountUser: User |
30 | 27 | ||
@@ -45,6 +42,7 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
45 | 42 | ||
46 | constructor ( | 43 | constructor ( |
47 | private route: ActivatedRoute, | 44 | private route: ActivatedRoute, |
45 | private router: Router, | ||
48 | private userService: UserService, | 46 | private userService: UserService, |
49 | private accountService: AccountService, | 47 | private accountService: AccountService, |
50 | private videoChannelService: VideoChannelService, | 48 | private videoChannelService: VideoChannelService, |
@@ -128,16 +126,10 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
128 | return $localize`${count} subscribers` | 126 | return $localize`${count} subscribers` |
129 | } | 127 | } |
130 | 128 | ||
131 | onOutletLoaded (component: Component) { | ||
132 | if (component instanceof AccountSearchComponent) { | ||
133 | this.accountSearch = component | ||
134 | } else { | ||
135 | this.accountSearch = undefined | ||
136 | } | ||
137 | } | ||
138 | |||
139 | searchChanged (search: string) { | 129 | searchChanged (search: string) { |
140 | if (this.accountSearch) this.accountSearch.updateSearch(search) | 130 | const queryParams = { search } |
131 | |||
132 | this.router.navigate([ './videos' ], { queryParams, relativeTo: this.route, queryParamsHandling: 'merge' }) | ||
141 | } | 133 | } |
142 | 134 | ||
143 | onSearchInputDisplayChanged (displayed: boolean) { | 135 | onSearchInputDisplayChanged (displayed: boolean) { |
@@ -152,6 +144,10 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
152 | return !this.accountDescriptionExpanded && this.accountDescriptionHTML.length > 100 | 144 | return !this.accountDescriptionExpanded && this.accountDescriptionHTML.length > 100 |
153 | } | 145 | } |
154 | 146 | ||
147 | isOnChannelPage () { | ||
148 | return this.route.children[0].snapshot.url[0].path === 'video-channels' | ||
149 | } | ||
150 | |||
155 | private async onAccount (account: Account) { | 151 | private async onAccount (account: Account) { |
156 | this.accountFollowerTitle = $localize`${account.followersCount} direct account followers` | 152 | this.accountFollowerTitle = $localize`${account.followersCount} direct account followers` |
157 | 153 | ||