VideoChannelService,
VideoService
} from '@app/shared/shared-main'
-import { AccountReportComponent } from '@app/shared/shared-moderation'
+import { AccountReportComponent, BlocklistService } from '@app/shared/shared-moderation'
import { HttpStatusCode, User, UserRight } from '@shared/models'
@Component({
links: ListOverflowItem[] = []
hideMenu = false
- accountFollowerTitle = ''
-
accountVideosCount: number
accountDescriptionHTML = ''
accountDescriptionExpanded = false
- prependModerationActions: DropdownAction<any>[]
+ prependModerationActions: DropdownAction<any>[] = []
private routeSub: Subscription
private authService: AuthService,
private videoService: VideoService,
private markdown: MarkdownService,
+ private blocklist: BlocklistService,
private screenService: ScreenService
) {
}
this.notifier.success($localize`Username copied`)
}
- subscribersDisplayFor (count: number) {
- if (count === 1) return $localize`1 subscriber`
-
- return $localize`${count} subscribers`
- }
-
searchChanged (search: string) {
const queryParams = { search }
}
private async onAccount (account: Account) {
- this.accountFollowerTitle = $localize`${account.followersCount} direct account followers`
-
- this.prependModerationActions = undefined
-
this.accountDescriptionHTML = await this.markdown.textMarkdownToHTML(account.description)
// After the markdown renderer to avoid layout changes
this.updateModerationActions()
this.loadUserIfNeeded(account)
this.loadAccountVideosCount()
+ this.loadAccountBlockStatus()
}
private showReportModal () {
- this.accountReportModal.show()
+ this.accountReportModal.show(this.account)
}
private loadUserIfNeeded (account: Account) {
}
private updateModerationActions () {
+ this.prependModerationActions = []
+
if (!this.authService.isLoggedIn()) return
this.authService.userInformationLoaded.subscribe(
// It's not our account, we can report it
this.prependModerationActions = [
+ {
+ label: $localize`Report`,
+ isHeader: true
+ },
{
label: $localize`Report this account`,
handler: () => this.showReportModal()
this.accountVideosCount = res.total
})
}
+
+ private loadAccountBlockStatus () {
+ this.blocklist.getStatus({ accounts: [ this.account.nameWithHostForced ], hosts: [ this.account.host ] })
+ .subscribe(status => this.account.updateBlockStatus(status))
+ }
}