mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into Docu-Template-Overview-2021
This commit is contained in:
commit
d840230fae
@ -1,4 +1,4 @@
|
||||
import { Resolver, Query, Arg, Args, Authorized, Mutation } from 'type-graphql'
|
||||
import { Resolver, Query, Arg, Args, Authorized, Mutation, Ctx } from 'type-graphql'
|
||||
import { getCustomRepository, Raw } from 'typeorm'
|
||||
import { UserAdmin } from '../model/UserAdmin'
|
||||
import { PendingCreation } from '../model/PendingCreation'
|
||||
@ -66,7 +66,7 @@ export class AdminResolver {
|
||||
return await getUserCreations(user.id)
|
||||
}
|
||||
|
||||
// @Authorized([RIGHTS.SEARCH_USERS])
|
||||
@Authorized([RIGHTS.SEARCH_USERS])
|
||||
@Mutation(() => UpdatePendingCreation)
|
||||
async updatePendingCreation(
|
||||
@Args() { id, email, amount, memo, creationDate, moderator }: UpdatePendingCreationArgs,
|
||||
@ -94,24 +94,9 @@ export class AdminResolver {
|
||||
result.creation = await getUserCreations(user.id)
|
||||
|
||||
return result
|
||||
|
||||
// const creations = await getUserCreations(user.id)
|
||||
// const creationDateObj = new Date(creationDate)
|
||||
// if (isCreationValid(creations, amount, creationDateObj)) {
|
||||
// const pendingCreationRepository = getCustomRepository(PendingCreationRepository)
|
||||
// const loginPendingTaskAdmin = pendingCreationRepository.create()
|
||||
// loginPendingTaskAdmin.userId = user.id
|
||||
// loginPendingTaskAdmin.amount = BigInt(amount * 10000)
|
||||
// loginPendingTaskAdmin.created = new Date()
|
||||
// loginPendingTaskAdmin.date = creationDateObj
|
||||
// loginPendingTaskAdmin.memo = memo
|
||||
// loginPendingTaskAdmin.moderator = moderator
|
||||
//
|
||||
// pendingCreationRepository.save(loginPendingTaskAdmin)
|
||||
// }
|
||||
// return await getUserCreations(user.id)
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.SEARCH_USERS])
|
||||
@Query(() => [PendingCreation])
|
||||
async getPendingCreations(): Promise<PendingCreation[]> {
|
||||
const loginPendingTasksAdminRepository = getCustomRepository(LoginPendingTasksAdminRepository)
|
||||
@ -139,6 +124,7 @@ export class AdminResolver {
|
||||
return pendingCreationsPromise.reverse()
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.SEARCH_USERS])
|
||||
@Mutation(() => Boolean)
|
||||
async deletePendingCreation(@Arg('id') id: number): Promise<boolean> {
|
||||
const loginPendingTasksAdminRepository = getCustomRepository(LoginPendingTasksAdminRepository)
|
||||
@ -147,11 +133,17 @@ export class AdminResolver {
|
||||
return !!res
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.SEARCH_USERS])
|
||||
@Mutation(() => Boolean)
|
||||
async confirmPendingCreation(@Arg('id') id: number): Promise<boolean> {
|
||||
async confirmPendingCreation(@Arg('id') id: number, @Ctx() context: any): Promise<boolean> {
|
||||
const loginPendingTasksAdminRepository = getCustomRepository(LoginPendingTasksAdminRepository)
|
||||
const pendingCreation = await loginPendingTasksAdminRepository.findOneOrFail(id)
|
||||
|
||||
const userRepository = getCustomRepository(UserRepository)
|
||||
const moderatorUser = await userRepository.findByPubkeyHex(context.pubKey)
|
||||
if (moderatorUser.id === pendingCreation.userId)
|
||||
throw new Error('Moderator can not confirm own pending creation')
|
||||
|
||||
const transactionRepository = getCustomRepository(TransactionRepository)
|
||||
const receivedCallDate = new Date()
|
||||
let transaction = new Transaction()
|
||||
|
||||
@ -30,6 +30,13 @@ loadAllRules(i18n)
|
||||
|
||||
addNavigationGuards(router, store, apolloProvider.defaultClient)
|
||||
|
||||
if (!store) {
|
||||
setTimeout(
|
||||
window.location.assign('https://github.com/gradido/gradido/tree/master/support#cookies'),
|
||||
5000,
|
||||
)
|
||||
}
|
||||
|
||||
/* eslint-disable no-new */
|
||||
new Vue({
|
||||
el: '#app',
|
||||
|
||||
@ -78,32 +78,41 @@ export const actions = {
|
||||
},
|
||||
}
|
||||
|
||||
export const store = new Vuex.Store({
|
||||
plugins: [
|
||||
createPersistedState({
|
||||
storage: window.localStorage,
|
||||
}),
|
||||
],
|
||||
state: {
|
||||
email: '',
|
||||
language: null,
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
username: '',
|
||||
description: '',
|
||||
token: null,
|
||||
isAdmin: false,
|
||||
coinanimation: true,
|
||||
newsletterState: null,
|
||||
community: {
|
||||
name: '',
|
||||
let store
|
||||
|
||||
try {
|
||||
store = new Vuex.Store({
|
||||
plugins: [
|
||||
createPersistedState({
|
||||
storage: window.localStorage,
|
||||
}),
|
||||
],
|
||||
state: {
|
||||
email: '',
|
||||
language: null,
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
username: '',
|
||||
description: '',
|
||||
token: null,
|
||||
isAdmin: false,
|
||||
coinanimation: true,
|
||||
newsletterState: null,
|
||||
community: {
|
||||
name: '',
|
||||
description: '',
|
||||
},
|
||||
hasElopage: false,
|
||||
publisherId: null,
|
||||
},
|
||||
hasElopage: false,
|
||||
publisherId: null,
|
||||
},
|
||||
getters: {},
|
||||
// Syncronous mutation of the state
|
||||
mutations,
|
||||
actions,
|
||||
})
|
||||
getters: {},
|
||||
// Syncronous mutation of the state
|
||||
mutations,
|
||||
actions,
|
||||
})
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
export { store }
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
import { mutations, actions } from './store'
|
||||
import Vuex from 'vuex'
|
||||
import Vue from 'vue'
|
||||
|
||||
jest.mock('vuex')
|
||||
|
||||
const {
|
||||
language,
|
||||
@ -298,4 +302,25 @@ describe('Vuex store', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('creation of store fails', () => {
|
||||
const consoleErrorMock = jest.fn()
|
||||
const warnHandler = Vue.config.warnHandler
|
||||
beforeEach(() => {
|
||||
Vue.config.warnHandler = (w) => {}
|
||||
// eslint-disable-next-line no-console
|
||||
console.error = consoleErrorMock
|
||||
Vuex.Store = () => {
|
||||
throw new Error('no-cookies-allowed')
|
||||
}
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
Vue.config.warnHandler = warnHandler
|
||||
})
|
||||
|
||||
it.skip('logs an error message', () => {
|
||||
expect(consoleErrorMock).toBeCalledWith('no-cookies-allowed')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
6
support/README.md
Normal file
6
support/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
## Cookies
|
||||
|
||||
Die Gradido Wallet benötigt Zugriff auf die local strorage des
|
||||
Browsers. Bitte stelle sicher, dass in deinem Browser Cookies für die
|
||||
Gradido Wallet erlaubt sind.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user