Merge branch 'master' into 1588-frontend-show-link-information

This commit is contained in:
Alexander Friedland 2022-03-21 14:37:04 +01:00 committed by GitHub
commit 1baf855265
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 10 deletions

View File

@ -1,7 +1,7 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
export const confirmPendingCreation = gql` export const confirmPendingCreation = gql`
mutation ($id: Float!) { mutation ($id: Int!) {
confirmPendingCreation(id: $id) confirmPendingCreation(id: $id)
} }
` `

View File

@ -1,7 +1,7 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
export const deletePendingCreation = gql` export const deletePendingCreation = gql`
mutation ($id: Float!) { mutation ($id: Int!) {
deletePendingCreation(id: $id) deletePendingCreation(id: $id)
} }
` `

View File

@ -1,7 +1,7 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
export const deleteUser = gql` export const deleteUser = gql`
mutation ($userId: Float!) { mutation ($userId: Int!) {
deleteUser(userId: $userId) deleteUser(userId: $userId)
} }
` `

View File

@ -1,7 +1,7 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
export const unDeleteUser = gql` export const unDeleteUser = gql`
mutation ($userId: Float!) { mutation ($userId: Int!) {
unDeleteUser(userId: $userId) unDeleteUser(userId: $userId)
} }
` `

View File

@ -99,7 +99,7 @@ export default {
}, },
updateDeletedAt(userId, deletedAt) { updateDeletedAt(userId, deletedAt) {
this.searchResult.find((obj) => obj.userId === userId).deletedAt = deletedAt this.searchResult.find((obj) => obj.userId === userId).deletedAt = deletedAt
this.toastSuccess(this.$t('user_deleted')) this.toastSuccess(deletedAt ? this.$t('user_deleted') : this.$t('user_recovered'))
}, },
}, },
watch: { watch: {

View File

@ -127,7 +127,10 @@ export class AdminResolver {
@Authorized([RIGHTS.DELETE_USER]) @Authorized([RIGHTS.DELETE_USER])
@Mutation(() => Date, { nullable: true }) @Mutation(() => Date, { nullable: true })
async deleteUser(@Arg('userId') userId: number, @Ctx() context: any): Promise<Date | null> { async deleteUser(
@Arg('userId', () => Int) userId: number,
@Ctx() context: any,
): Promise<Date | null> {
const user = await dbUser.findOne({ id: userId }) const user = await dbUser.findOne({ id: userId })
// user exists ? // user exists ?
if (!user) { if (!user) {
@ -146,7 +149,7 @@ export class AdminResolver {
@Authorized([RIGHTS.UNDELETE_USER]) @Authorized([RIGHTS.UNDELETE_USER])
@Mutation(() => Date, { nullable: true }) @Mutation(() => Date, { nullable: true })
async unDeleteUser(@Arg('userId') userId: number): Promise<Date | null> { async unDeleteUser(@Arg('userId', () => Int) userId: number): Promise<Date | null> {
const user = await dbUser.findOne({ id: userId }, { withDeleted: true }) const user = await dbUser.findOne({ id: userId }, { withDeleted: true })
// user exists ? // user exists ?
if (!user) { if (!user) {
@ -288,7 +291,7 @@ export class AdminResolver {
@Authorized([RIGHTS.DELETE_PENDING_CREATION]) @Authorized([RIGHTS.DELETE_PENDING_CREATION])
@Mutation(() => Boolean) @Mutation(() => Boolean)
async deletePendingCreation(@Arg('id') id: number): Promise<boolean> { async deletePendingCreation(@Arg('id', () => Int) id: number): Promise<boolean> {
const entity = await AdminPendingCreation.findOneOrFail(id) const entity = await AdminPendingCreation.findOneOrFail(id)
const res = await AdminPendingCreation.delete(entity) const res = await AdminPendingCreation.delete(entity)
return !!res return !!res
@ -296,7 +299,10 @@ export class AdminResolver {
@Authorized([RIGHTS.CONFIRM_PENDING_CREATION]) @Authorized([RIGHTS.CONFIRM_PENDING_CREATION])
@Mutation(() => Boolean) @Mutation(() => Boolean)
async confirmPendingCreation(@Arg('id') id: number, @Ctx() context: any): Promise<boolean> { async confirmPendingCreation(
@Arg('id', () => Int) id: number,
@Ctx() context: any,
): Promise<boolean> {
const pendingCreation = await AdminPendingCreation.findOneOrFail(id) const pendingCreation = await AdminPendingCreation.findOneOrFail(id)
const moderatorUser = context.user const moderatorUser = context.user
if (moderatorUser.id === pendingCreation.userId) if (moderatorUser.id === pendingCreation.userId)

View File

@ -94,7 +94,7 @@ export const createPendingCreation = gql`
` `
export const confirmPendingCreation = gql` export const confirmPendingCreation = gql`
mutation ($id: Float!) { mutation ($id: Int!) {
confirmPendingCreation(id: $id) confirmPendingCreation(id: $id)
} }
` `