mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Check for emailChecked in the user search and giving the value to the UserTable
This commit is contained in:
parent
0e896ef7d2
commit
8e974bbc22
@ -64,18 +64,14 @@
|
||||
|
||||
<template #cell(confirm_mail)="row">
|
||||
<b-button
|
||||
:variant="row.item.firstName === 'Peter' ? 'success' : 'danger'"
|
||||
:variant="row.item.emailChecked ? 'success' : 'danger'"
|
||||
size="md"
|
||||
:ref="'showing_registermail_detals_' + row.detailsShowing"
|
||||
@click="
|
||||
row.item.firstName !== 'Peter'
|
||||
? rowDetailsToogleRegisterMail(row, row.detailsShowing)
|
||||
: ''
|
||||
"
|
||||
@click="!row.item.emailChecked ? rowDetailsToogleRegisterMail(row, row.detailsShowing) : ''"
|
||||
class="mr-2"
|
||||
>
|
||||
<b-icon
|
||||
:icon="row.item.firstName === 'Peter' ? 'envelope-open' : 'envelope'"
|
||||
:icon="row.item.emailChecked ? 'envelope-open' : 'envelope'"
|
||||
aria-label="Help"
|
||||
></b-icon>
|
||||
</b-button>
|
||||
|
||||
@ -7,6 +7,7 @@ export const searchUsers = gql`
|
||||
lastName
|
||||
email
|
||||
creation
|
||||
emailChecked
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
@ -13,4 +13,7 @@ export class UserAdmin {
|
||||
|
||||
@Field(() => [Number])
|
||||
creation: number[]
|
||||
|
||||
@Field(() => Boolean)
|
||||
emailChecked: boolean
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import { UserTransaction } from '@entity/UserTransaction'
|
||||
import { UserTransactionRepository } from '../../typeorm/repository/UserTransaction'
|
||||
import { BalanceRepository } from '../../typeorm/repository/Balance'
|
||||
import { calculateDecay } from '../../util/decay'
|
||||
import { LoginUserRepository } from '../../typeorm/repository/LoginUser'
|
||||
|
||||
@Resolver()
|
||||
export class AdminResolver {
|
||||
@ -32,6 +33,7 @@ export class AdminResolver {
|
||||
adminUser.lastName = user.lastName
|
||||
adminUser.email = user.email
|
||||
adminUser.creation = await getUserCreations(user.id)
|
||||
adminUser.emailChecked = await hasActivatedEmail(user.email)
|
||||
return adminUser
|
||||
}),
|
||||
)
|
||||
@ -315,3 +317,10 @@ function isCreationValid(creations: number[], amount: number, creationDate: Date
|
||||
}
|
||||
return true
|
||||
}
|
||||
async function hasActivatedEmail(email: string): Promise<boolean> {
|
||||
const repository = getCustomRepository(LoginUserRepository)
|
||||
const user = await repository.findByEmail(email)
|
||||
let emailActivate = false
|
||||
if (user) emailActivate = user.emailChecked
|
||||
return emailActivate
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user