import { SortMeta } from 'primeng/api'
import { Component, OnInit, ViewChild } from '@angular/core'
-import { ActivatedRoute, Params, Router } from '@angular/router'
+import { ActivatedRoute, Router } from '@angular/router'
import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core'
-import { Account, DropdownAction } from '@app/shared/shared-main'
+import { AdvancedInputFilter } from '@app/shared/shared-forms'
+import { DropdownAction } from '@app/shared/shared-main'
import { UserBanModalComponent } from '@app/shared/shared-moderation'
import { ServerConfig, User, UserRole } from '@shared/models'
@ViewChild('userBanModal', { static: true }) userBanModal: UserBanModalComponent
users: User[] = []
+
totalRecords = 0
sort: SortMeta = { field: 'createdAt', order: 1 }
pagination: RestPagination = { count: this.rowsPerPage, start: 0 }
+
highlightBannedUsers = false
selectedUsers: User[] = []
bulkUserActions: DropdownAction<User[]>[][] = []
columns: { id: string, label: string }[]
+ inputFilters: AdvancedInputFilter[] = [
+ {
+ queryParams: { 'search': 'banned:true' },
+ label: $localize`Banned users`
+ }
+ ]
+
private _selectedColumns: string[]
private serverConfig: ServerConfig
.subscribe(config => this.serverConfig = config)
this.initialize()
- this.listenToSearchChange()
this.bulkUserActions = [
[
}
onUserChanged () {
- this.loadData()
- }
-
- switchToDefaultAvatar ($event: Event) {
- ($event.target as HTMLImageElement).src = Account.GET_DEFAULT_AVATAR_URL()
+ this.reloadData()
}
async unbanUsers (users: User[]) {
.subscribe(
() => {
this.notifier.success($localize`${users.length} users unbanned.`)
- this.loadData()
+ this.reloadData()
},
err => this.notifier.error(err.message)
this.userService.removeUser(users).subscribe(
() => {
this.notifier.success($localize`${users.length} users deleted.`)
- this.loadData()
+ this.reloadData()
},
err => this.notifier.error(err.message)
this.userService.updateUsers(users, { emailVerified: true }).subscribe(
() => {
this.notifier.success($localize`${users.length} users email set as verified.`)
- this.loadData()
+ this.reloadData()
},
err => this.notifier.error(err.message)
return this.selectedUsers.length !== 0
}
- protected loadData () {
+ protected reloadData () {
this.selectedUsers = []
this.userService.getUsers({