Merge branch '1588-frontend-show-link-information' of github.com:gradido/gradido into 1588-frontend-show-link-information

This commit is contained in:
Moriz Wahl 2022-03-21 14:39:49 +01:00
commit 8bfe350026
9 changed files with 21 additions and 52 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -99,7 +99,7 @@ export default {
},
updateDeletedAt(userId, 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: {

View File

@ -127,7 +127,10 @@ export class AdminResolver {
@Authorized([RIGHTS.DELETE_USER])
@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 })
// user exists ?
if (!user) {
@ -146,7 +149,7 @@ export class AdminResolver {
@Authorized([RIGHTS.UNDELETE_USER])
@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 })
// user exists ?
if (!user) {
@ -288,7 +291,7 @@ export class AdminResolver {
@Authorized([RIGHTS.DELETE_PENDING_CREATION])
@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 res = await AdminPendingCreation.delete(entity)
return !!res
@ -296,7 +299,10 @@ export class AdminResolver {
@Authorized([RIGHTS.CONFIRM_PENDING_CREATION])
@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 moderatorUser = context.user
if (moderatorUser.id === pendingCreation.userId)

View File

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

View File

@ -42,10 +42,6 @@
</validation-observer>
</b-card-body>
</b-card>
<div v-if="$route.params.code" class="mt-2 mb-2">
{{ $t('gdd_per_link.redeem') + ':' }}
<b>{{ $route.params.code }}</b>
</div>
<b-row class="mt-3">
<b-col cols="6" class="text-center text-sm-left col-12 col-sm-6 pb-5">
<router-link to="/forgot-password" class="mt-3">
@ -68,7 +64,6 @@ import InputPassword from '@/components/Inputs/InputPassword'
import InputEmail from '@/components/Inputs/InputEmail'
import { login } from '@/graphql/queries'
import { getCommunityInfoMixin } from '@/mixins/getCommunityInfo'
import { redeemTransactionLink } from '@/graphql/mutations'
export default {
name: 'Login',
@ -101,16 +96,17 @@ export default {
},
fetchPolicy: 'network-only',
})
.then((result) => {
.then(async (result) => {
const {
data: { login },
} = result
this.$store.dispatch('login', login)
await loader.hide()
if (this.$route.params.code) {
this.redeemLink(this.$route.params.code)
this.$router.push(`/redeem/${this.$route.params.code}`)
} else {
this.$router.push('/overview')
}
this.$router.push('/overview')
loader.hide()
})
.catch((error) => {
this.toastError(this.$t('error.no-account'))
@ -122,21 +118,6 @@ export default {
loader.hide()
})
},
redeemLink(code) {
this.$apollo
.mutate({
mutation: redeemTransactionLink,
variables: {
code: code,
},
})
.then(() => {
this.toastSuccess(this.$t('gdd_per_link.successfully-redeemed'))
})
.catch((err) => {
this.toastError(err.message)
})
},
},
}
</script>

View File

@ -118,24 +118,6 @@
{{ messageError }}
</span>
</b-alert>
<b-row v-if="redeemCode">
<b-col>
<label>{{ $t('gdd_per_link.redeem') }}</label>
<div class="mt-2 mb-2">
<b-input-group class="shadow-sm p-2 bg-white rounded">
<b-input-group-prepend is-text>
<b-icon icon="link45deg"></b-icon>
</b-input-group-prepend>
<b-form-input
readonly
id="redeem-code"
type="text"
v-model="redeemCode"
></b-form-input>
</b-input-group>
</div>
</b-col>
</b-row>
<b-row
v-else