import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
-import { AuthService, ConfirmService, Notifier, ServerService, UserService } from '@app/core'
+import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
import { Account, DropdownAction } from '@app/shared/shared-main'
import { BulkRemoveCommentsOfBody, User, UserRight } from '@shared/models'
+import { UserAdminService } from '../shared-users'
import { BlocklistService } from './blocklist.service'
import { BulkService } from './bulk.service'
import { UserBanModalComponent } from './user-ban-modal.component'
private notifier: Notifier,
private confirmService: ConfirmService,
private serverService: ServerService,
- private userService: UserService,
+ private userAdminService: UserAdminService,
private blocklistService: BlocklistService,
private bulkService: BulkService
) { }
const res = await this.confirmService.confirm($localize`Do you really want to unban ${user.username}?`, $localize`Unban`)
if (res === false) return
- this.userService.unbanUsers(user)
+ this.userAdminService.unbanUsers(user)
.subscribe({
next: () => {
this.notifier.success($localize`User ${user.username} unbanned.`)
return
}
- const message = $localize`If you remove this user, you will not be able to create another with the same username!`
- const res = await this.confirmService.confirm(message, $localize`Delete`)
+ const message = $localize`If you remove user ${user.username}, you won't be able to create another with the same username!`
+ const res = await this.confirmService.confirm(message, $localize`Delete ${user.username}`)
if (res === false) return
- this.userService.removeUser(user)
+ this.userAdminService.removeUser(user)
.subscribe({
next: () => {
this.notifier.success($localize`User ${user.username} deleted.`)
}
setEmailAsVerified (user: User) {
- this.userService.updateUser(user.id, { emailVerified: true })
+ this.userAdminService.updateUser(user.id, { emailVerified: true })
.subscribe({
next: () => {
this.notifier.success($localize`User ${user.username} email set as verified`)
const myAccountActions: DropdownAction<{ user: User, account: Account }>[] = [
{
- label: $localize`Personal moderation`,
+ label: $localize`My account moderation`,
class: [ 'red' ],
isHeader: true
},
{
label: $localize`Mute the instance`,
description: $localize`Hide any content from that instance for you.`,
- isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false,
+ isDisplayed: ({ account }) => !account.userId && account.mutedServerByUser === false,
handler: ({ account }) => this.blockServerByUser(account.host)
},
{
label: $localize`Unmute the instance`,
description: $localize`Show back content from that instance for you.`,
- isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true,
+ isDisplayed: ({ account }) => !account.userId && account.mutedServerByUser === true,
handler: ({ account }) => this.unblockServerByUser(account.host)
},
{