mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into fix-store-problems
This commit is contained in:
commit
eb570ada63
@ -1,3 +1,3 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
build/
|
||||||
coverage/
|
coverage/
|
||||||
2
admin/.gitignore
vendored
2
admin/.gitignore
vendored
@ -1,5 +1,5 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
build/
|
||||||
.cache/
|
.cache/
|
||||||
|
|
||||||
/.env
|
/.env
|
||||||
|
|||||||
@ -84,7 +84,7 @@ CMD /bin/sh -c "yarn run dev"
|
|||||||
FROM base as production
|
FROM base as production
|
||||||
|
|
||||||
# Copy "binary"-files from build image
|
# Copy "binary"-files from build image
|
||||||
COPY --from=build ${DOCKER_WORKDIR}/dist ./dist
|
COPY --from=build ${DOCKER_WORKDIR}/build ./build
|
||||||
# We also copy the node_modules express and serve-static for the run script
|
# We also copy the node_modules express and serve-static for the run script
|
||||||
COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules
|
COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules
|
||||||
# Copy static files
|
# Copy static files
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
"serve": "vue-cli-service serve --open",
|
"serve": "vue-cli-service serve --open",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
"dev": "yarn run serve",
|
"dev": "yarn run serve",
|
||||||
"analyse-bundle": "yarn build && webpack-bundle-analyzer dist/webpack.stats.json",
|
"analyse-bundle": "yarn build && webpack-bundle-analyzer build/webpack.stats.json",
|
||||||
"lint": "eslint --max-warnings=0 --ext .js,.vue,.json .",
|
"lint": "eslint --max-warnings=0 --ext .js,.vue,.json .",
|
||||||
"stylelint": "stylelint --max-warnings=0 '**/*.{scss,vue}'",
|
"stylelint": "stylelint --max-warnings=0 '**/*.{scss,vue}'",
|
||||||
"test": "cross-env TZ=UTC jest",
|
"test": "cross-env TZ=UTC jest",
|
||||||
|
|||||||
@ -9,10 +9,10 @@ const port = process.env.PORT || 8080
|
|||||||
// Express Server
|
// Express Server
|
||||||
const app = express()
|
const app = express()
|
||||||
// Serve files
|
// Serve files
|
||||||
app.use(express.static(path.join(__dirname, '../dist')))
|
app.use(express.static(path.join(__dirname, '../build')))
|
||||||
// Default to index.html
|
// Default to index.html
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
res.sendFile(path.join(__dirname, '../dist/index.html'))
|
res.sendFile(path.join(__dirname, '../build/index.html'))
|
||||||
})
|
})
|
||||||
|
|
||||||
app.listen(port, hostname, () => {
|
app.listen(port, hostname, () => {
|
||||||
|
|||||||
@ -49,5 +49,5 @@ module.exports = {
|
|||||||
// Enable CSS source maps.
|
// Enable CSS source maps.
|
||||||
sourceMap: CONFIG.NODE_ENV !== 'production',
|
sourceMap: CONFIG.NODE_ENV !== 'production',
|
||||||
},
|
},
|
||||||
outputDir: path.resolve(__dirname, './dist'),
|
outputDir: path.resolve(__dirname, './build'),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import { User as dbUser } from '@entity/User'
|
|||||||
import { ObjectType, Field, Int } from 'type-graphql'
|
import { ObjectType, Field, Int } from 'type-graphql'
|
||||||
|
|
||||||
import { KlickTipp } from './KlickTipp'
|
import { KlickTipp } from './KlickTipp'
|
||||||
import { UserContact } from './UserContact'
|
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class User {
|
export class User {
|
||||||
@ -10,10 +9,7 @@ export class User {
|
|||||||
this.id = user.id
|
this.id = user.id
|
||||||
this.gradidoID = user.gradidoID
|
this.gradidoID = user.gradidoID
|
||||||
this.alias = user.alias
|
this.alias = user.alias
|
||||||
this.emailId = user.emailId
|
|
||||||
if (user.emailContact) {
|
if (user.emailContact) {
|
||||||
this.email = user.emailContact.email
|
|
||||||
this.emailContact = new UserContact(user.emailContact)
|
|
||||||
this.emailChecked = user.emailContact.emailChecked
|
this.emailChecked = user.emailContact.emailChecked
|
||||||
}
|
}
|
||||||
this.firstName = user.firstName
|
this.firstName = user.firstName
|
||||||
@ -38,16 +34,6 @@ export class User {
|
|||||||
@Field(() => String, { nullable: true })
|
@Field(() => String, { nullable: true })
|
||||||
alias: string | null
|
alias: string | null
|
||||||
|
|
||||||
@Field(() => Int, { nullable: true })
|
|
||||||
emailId: number | null
|
|
||||||
|
|
||||||
// TODO privacy issue here
|
|
||||||
@Field(() => String, { nullable: true })
|
|
||||||
email: string | null
|
|
||||||
|
|
||||||
@Field(() => UserContact)
|
|
||||||
emailContact: UserContact
|
|
||||||
|
|
||||||
@Field(() => String, { nullable: true })
|
@Field(() => String, { nullable: true })
|
||||||
firstName: string | null
|
firstName: string | null
|
||||||
|
|
||||||
|
|||||||
@ -20,12 +20,15 @@ import {
|
|||||||
login,
|
login,
|
||||||
sendCoins,
|
sendCoins,
|
||||||
} from '@/seeds/graphql/mutations'
|
} from '@/seeds/graphql/mutations'
|
||||||
|
import { transactionsQuery } from '@/seeds/graphql/queries'
|
||||||
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
|
||||||
import { garrickOllivander } from '@/seeds/users/garrick-ollivander'
|
import { garrickOllivander } from '@/seeds/users/garrick-ollivander'
|
||||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||||
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
import { stephenHawking } from '@/seeds/users/stephen-hawking'
|
||||||
|
|
||||||
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
let mutate: ApolloServerTestClient['mutate'], con: Connection
|
||||||
|
let query: ApolloServerTestClient['query']
|
||||||
|
|
||||||
let testEnv: {
|
let testEnv: {
|
||||||
mutate: ApolloServerTestClient['mutate']
|
mutate: ApolloServerTestClient['mutate']
|
||||||
query: ApolloServerTestClient['query']
|
query: ApolloServerTestClient['query']
|
||||||
@ -35,6 +38,7 @@ let testEnv: {
|
|||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
testEnv = await testEnvironment(logger)
|
testEnv = await testEnvironment(logger)
|
||||||
mutate = testEnv.mutate
|
mutate = testEnv.mutate
|
||||||
|
query = testEnv.query
|
||||||
con = testEnv.con
|
con = testEnv.con
|
||||||
await cleanDB()
|
await cleanDB()
|
||||||
})
|
})
|
||||||
@ -442,3 +446,42 @@ describe('send coins', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('transactionList', () => {
|
||||||
|
describe('unauthenticated', () => {
|
||||||
|
it('throws an error', async () => {
|
||||||
|
await expect(query({ query: transactionsQuery })).resolves.toMatchObject({
|
||||||
|
errors: [new GraphQLError('401 Unauthorized')],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('authenticated', () => {
|
||||||
|
describe('no transactions', () => {
|
||||||
|
beforeAll(async () => {
|
||||||
|
await userFactory(testEnv, bobBaumeister)
|
||||||
|
await mutate({
|
||||||
|
mutation: login,
|
||||||
|
variables: {
|
||||||
|
email: 'bob@baumeister.de',
|
||||||
|
password: 'Aa12345_',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has no transactions and balance 0', async () => {
|
||||||
|
await expect(query({ query: transactionsQuery })).resolves.toMatchObject({
|
||||||
|
data: {
|
||||||
|
transactionList: {
|
||||||
|
balance: expect.objectContaining({
|
||||||
|
balance: expect.decimalEqual(0),
|
||||||
|
}),
|
||||||
|
transactions: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
errors: undefined,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|||||||
@ -680,7 +680,6 @@ describe('UserResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
data: {
|
||||||
login: {
|
login: {
|
||||||
email: 'bibi@bloxberg.de',
|
|
||||||
firstName: 'Bibi',
|
firstName: 'Bibi',
|
||||||
hasElopage: false,
|
hasElopage: false,
|
||||||
id: expect.any(Number),
|
id: expect.any(Number),
|
||||||
@ -953,7 +952,6 @@ describe('UserResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
data: {
|
||||||
verifyLogin: {
|
verifyLogin: {
|
||||||
email: 'bibi@bloxberg.de',
|
|
||||||
firstName: 'Bibi',
|
firstName: 'Bibi',
|
||||||
lastName: 'Bloxberg',
|
lastName: 'Bloxberg',
|
||||||
language: 'de',
|
language: 'de',
|
||||||
@ -1310,7 +1308,7 @@ describe('UserResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
data: {
|
||||||
login: expect.objectContaining({
|
login: expect.objectContaining({
|
||||||
email: 'bibi@bloxberg.de',
|
firstName: 'Benjamin',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
@ -1457,7 +1455,6 @@ describe('UserResolver', () => {
|
|||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
data: {
|
||||||
login: {
|
login: {
|
||||||
email: 'bibi@bloxberg.de',
|
|
||||||
firstName: 'Bibi',
|
firstName: 'Bibi',
|
||||||
hasElopage: false,
|
hasElopage: false,
|
||||||
id: expect.any(Number),
|
id: expect.any(Number),
|
||||||
|
|||||||
@ -130,7 +130,7 @@ export class UserResolver {
|
|||||||
// Elopage Status & Stored PublisherId
|
// Elopage Status & Stored PublisherId
|
||||||
user.hasElopage = await this.hasElopage(context)
|
user.hasElopage = await this.hasElopage(context)
|
||||||
|
|
||||||
logger.debug(`verifyLogin... successful: ${user.firstName}.${user.lastName}, ${user.email}`)
|
logger.debug(`verifyLogin... successful: ${user.firstName}.${user.lastName}`)
|
||||||
return user
|
return user
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,6 @@ export class UserResolver {
|
|||||||
const user = new User(communityDbUser)
|
const user = new User(communityDbUser)
|
||||||
user.id = sodium.randombytes_random() % (2048 * 16) // TODO: for a better faking derive id from email so that it will be always the same id when the same email comes in?
|
user.id = sodium.randombytes_random() % (2048 * 16) // TODO: for a better faking derive id from email so that it will be always the same id when the same email comes in?
|
||||||
user.gradidoID = uuidv4()
|
user.gradidoID = uuidv4()
|
||||||
user.email = email
|
|
||||||
user.firstName = firstName
|
user.firstName = firstName
|
||||||
user.lastName = lastName
|
user.lastName = lastName
|
||||||
user.language = language
|
user.language = language
|
||||||
|
|||||||
@ -305,7 +305,6 @@ export const login = gql`
|
|||||||
mutation ($email: String!, $password: String!, $publisherId: Int) {
|
mutation ($email: String!, $password: String!, $publisherId: Int) {
|
||||||
login(email: $email, password: $password, publisherId: $publisherId) {
|
login(email: $email, password: $password, publisherId: $publisherId) {
|
||||||
id
|
id
|
||||||
email
|
|
||||||
firstName
|
firstName
|
||||||
lastName
|
lastName
|
||||||
language
|
language
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import { gql } from 'graphql-tag'
|
|||||||
export const verifyLogin = gql`
|
export const verifyLogin = gql`
|
||||||
query {
|
query {
|
||||||
verifyLogin {
|
verifyLogin {
|
||||||
email
|
|
||||||
firstName
|
firstName
|
||||||
lastName
|
lastName
|
||||||
language
|
language
|
||||||
@ -24,31 +23,26 @@ export const queryOptIn = gql`
|
|||||||
`
|
`
|
||||||
|
|
||||||
export const transactionsQuery = gql`
|
export const transactionsQuery = gql`
|
||||||
query (
|
query ($currentPage: Int = 1, $pageSize: Int = 25, $order: Order = DESC) {
|
||||||
$currentPage: Int = 1
|
transactionList(currentPage: $currentPage, pageSize: $pageSize, order: $order) {
|
||||||
$pageSize: Int = 25
|
balance {
|
||||||
$order: Order = DESC
|
balance
|
||||||
$onlyCreations: Boolean = false
|
balanceGDT
|
||||||
) {
|
count
|
||||||
transactionList(
|
linkCount
|
||||||
currentPage: $currentPage
|
}
|
||||||
pageSize: $pageSize
|
|
||||||
order: $order
|
|
||||||
onlyCreations: $onlyCreations
|
|
||||||
) {
|
|
||||||
balanceGDT
|
|
||||||
count
|
|
||||||
balance
|
|
||||||
transactions {
|
transactions {
|
||||||
id
|
id
|
||||||
typeId
|
typeId
|
||||||
amount
|
amount
|
||||||
balance
|
balance
|
||||||
|
previousBalance
|
||||||
balanceDate
|
balanceDate
|
||||||
memo
|
memo
|
||||||
linkedUser {
|
linkedUser {
|
||||||
firstName
|
firstName
|
||||||
lastName
|
lastName
|
||||||
|
gradidoID
|
||||||
}
|
}
|
||||||
decay {
|
decay {
|
||||||
decay
|
decay
|
||||||
@ -56,6 +50,7 @@ export const transactionsQuery = gql`
|
|||||||
end
|
end
|
||||||
duration
|
duration
|
||||||
}
|
}
|
||||||
|
linkId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,7 +117,7 @@ server {
|
|||||||
|
|
||||||
# TODO this could be a performance optimization
|
# TODO this could be a performance optimization
|
||||||
#location /vue {
|
#location /vue {
|
||||||
# alias /var/www/html/gradido/frontend/dist;
|
# alias /var/www/html/gradido/frontend/build;
|
||||||
# index index.html;
|
# index index.html;
|
||||||
#
|
#
|
||||||
# location ~* \.(png)$ {
|
# location ~* \.(png)$ {
|
||||||
|
|||||||
@ -103,7 +103,7 @@ server {
|
|||||||
|
|
||||||
# TODO this could be a performance optimization
|
# TODO this could be a performance optimization
|
||||||
#location /vue {
|
#location /vue {
|
||||||
# alias /var/www/html/gradido/frontend/dist;
|
# alias /var/www/html/gradido/frontend/build;
|
||||||
# index index.html;
|
# index index.html;
|
||||||
#
|
#
|
||||||
# location ~* \.(png)$ {
|
# location ~* \.(png)$ {
|
||||||
|
|||||||
@ -15,6 +15,6 @@ export NVM_DIR="/root/.nvm"
|
|||||||
$NPM_BIN install
|
$NPM_BIN install
|
||||||
$NPM_BIN run build
|
$NPM_BIN run build
|
||||||
# prezip for faster deliver throw nginx
|
# prezip for faster deliver throw nginx
|
||||||
cd dist
|
cd build
|
||||||
find . -type f -name "*.css" -exec gzip -9 -k {} \;
|
find . -type f -name "*.css" -exec gzip -9 -k {} \;
|
||||||
find . -type f -name "*.js" -exec gzip -9 -k {} \;
|
find . -type f -name "*.js" -exec gzip -9 -k {} \;
|
||||||
|
|||||||
@ -130,6 +130,15 @@ rm -Rf $PROJECT_ROOT/admin/node_modules
|
|||||||
rm -Rf $PROJECT_ROOT/dht-node/node_modules
|
rm -Rf $PROJECT_ROOT/dht-node/node_modules
|
||||||
rm -Rf $PROJECT_ROOT/federation/node_modules
|
rm -Rf $PROJECT_ROOT/federation/node_modules
|
||||||
|
|
||||||
|
# Remove build folders
|
||||||
|
# we had problems with corrupted incremtal builds
|
||||||
|
rm -Rf $PROJECT_ROOT/database/build
|
||||||
|
rm -Rf $PROJECT_ROOT/backend/build
|
||||||
|
rm -Rf $PROJECT_ROOT/frontend/build
|
||||||
|
rm -Rf $PROJECT_ROOT/admin/build
|
||||||
|
rm -Rf $PROJECT_ROOT/dht-node/build
|
||||||
|
rm -Rf $PROJECT_ROOT/federation/build
|
||||||
|
|
||||||
# Regenerate .env files
|
# Regenerate .env files
|
||||||
cp -f $PROJECT_ROOT/database/.env $PROJECT_ROOT/database/.env.bak
|
cp -f $PROJECT_ROOT/database/.env $PROJECT_ROOT/database/.env.bak
|
||||||
cp -f $PROJECT_ROOT/backend/.env $PROJECT_ROOT/backend/.env.bak
|
cp -f $PROJECT_ROOT/backend/.env $PROJECT_ROOT/backend/.env.bak
|
||||||
|
|||||||
@ -58,7 +58,7 @@ export default defineConfig({
|
|||||||
mailserverURL: 'http://localhost:1080',
|
mailserverURL: 'http://localhost:1080',
|
||||||
loginQuery: `mutation ($email: String!, $password: String!, $publisherId: Int) {
|
loginQuery: `mutation ($email: String!, $password: String!, $publisherId: Int) {
|
||||||
login(email: $email, password: $password, publisherId: $publisherId) {
|
login(email: $email, password: $password, publisherId: $publisherId) {
|
||||||
email
|
id
|
||||||
firstName
|
firstName
|
||||||
lastName
|
lastName
|
||||||
language
|
language
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
build/
|
||||||
coverage/
|
coverage/
|
||||||
2
frontend/.gitignore
vendored
2
frontend/.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
build/
|
||||||
.cache/
|
.cache/
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
|
|||||||
@ -84,7 +84,7 @@ CMD /bin/sh -c "yarn run dev"
|
|||||||
FROM base as production
|
FROM base as production
|
||||||
|
|
||||||
# Copy "binary"-files from build image
|
# Copy "binary"-files from build image
|
||||||
COPY --from=build ${DOCKER_WORKDIR}/dist ./dist
|
COPY --from=build ${DOCKER_WORKDIR}/build ./build
|
||||||
# We also copy the node_modules express and serve-static for the run script
|
# We also copy the node_modules express and serve-static for the run script
|
||||||
COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules
|
COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules
|
||||||
# Copy static files
|
# Copy static files
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
"serve": "vue-cli-service serve --open",
|
"serve": "vue-cli-service serve --open",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
"dev": "yarn run serve",
|
"dev": "yarn run serve",
|
||||||
"analyse-bundle": "yarn build && webpack-bundle-analyzer dist/webpack.stats.json",
|
"analyse-bundle": "yarn build && webpack-bundle-analyzer build/webpack.stats.json",
|
||||||
"lint": "eslint --max-warnings=0 --ext .js,.vue,.json .",
|
"lint": "eslint --max-warnings=0 --ext .js,.vue,.json .",
|
||||||
"stylelint": "stylelint --max-warnings=0 '**/*.{scss,vue}'",
|
"stylelint": "stylelint --max-warnings=0 '**/*.{scss,vue}'",
|
||||||
"test": "cross-env TZ=UTC jest",
|
"test": "cross-env TZ=UTC jest",
|
||||||
|
|||||||
@ -9,10 +9,10 @@ const port = process.env.PORT || 3000
|
|||||||
// Express Server
|
// Express Server
|
||||||
const app = express()
|
const app = express()
|
||||||
// Serve files
|
// Serve files
|
||||||
app.use(express.static(path.join(__dirname, '../dist')))
|
app.use(express.static(path.join(__dirname, '../build')))
|
||||||
// Default to index.html
|
// Default to index.html
|
||||||
app.get('*', (req, res) => {
|
app.get('*', (req, res) => {
|
||||||
res.sendFile(path.join(__dirname, '../dist/index.html'))
|
res.sendFile(path.join(__dirname, '../build/index.html'))
|
||||||
})
|
})
|
||||||
|
|
||||||
app.listen(port, hostname, () => {
|
app.listen(port, hostname, () => {
|
||||||
|
|||||||
@ -15,7 +15,7 @@ describe('LanguageSwitch', () => {
|
|||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
email: 'he@ho.he',
|
gradidoID: 'current-user-id',
|
||||||
language: null,
|
language: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ export default {
|
|||||||
async saveLocale(locale) {
|
async saveLocale(locale) {
|
||||||
// if (this.$i18n.locale === locale) return
|
// if (this.$i18n.locale === locale) return
|
||||||
this.setLocale(locale)
|
this.setLocale(locale)
|
||||||
if (this.$store.state.email) {
|
if (this.$store.state.gradidoID) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: updateUserInfos,
|
mutation: updateUserInfos,
|
||||||
|
|||||||
@ -15,7 +15,7 @@ describe('LanguageSwitch', () => {
|
|||||||
let wrapper
|
let wrapper
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
email: 'he@ho.he',
|
gradidoID: 'current-user-id',
|
||||||
language: null,
|
language: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ export default {
|
|||||||
async saveLocale(locale) {
|
async saveLocale(locale) {
|
||||||
if (this.$i18n.locale === locale) return
|
if (this.$i18n.locale === locale) return
|
||||||
this.setLocale(locale)
|
this.setLocale(locale)
|
||||||
if (this.$store.state.email) {
|
if (this.$store.state.gradidoID) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: updateUserInfos,
|
mutation: updateUserInfos,
|
||||||
|
|||||||
@ -20,7 +20,7 @@ const mocks = {
|
|||||||
state: {
|
state: {
|
||||||
firstName: 'Testy',
|
firstName: 'Testy',
|
||||||
lastName: 'User',
|
lastName: 'User',
|
||||||
email: 'testy.user@example.com',
|
gradidoID: 'current-user-id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -64,8 +64,8 @@ describe('AuthNavbar', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has the email address', () => {
|
// I think this should be username
|
||||||
// expect(wrapper.find('div.small:nth-child(2)').text()).toBe(wrapper.vm.$store.state.email)
|
it.skip('has the email address', () => {
|
||||||
expect(wrapper.find('div[data-test="navbar-item-email"]').text()).toBe(
|
expect(wrapper.find('div[data-test="navbar-item-email"]').text()).toBe(
|
||||||
wrapper.vm.$store.state.email,
|
wrapper.vm.$store.state.email,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -39,37 +39,5 @@ describe('AmountAndNameRow', () => {
|
|||||||
expect(wrapper.find('div.gdd-transaction-list-item-name').find('a').exists()).toBe(false)
|
expect(wrapper.find('div.gdd-transaction-list-item-name').find('a').exists()).toBe(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('with linked user', () => {
|
|
||||||
beforeEach(async () => {
|
|
||||||
await wrapper.setProps({
|
|
||||||
linkedUser: { firstName: 'Bibi', lastName: 'Bloxberg', email: 'bibi@bloxberg.de' },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('has a link with first and last name', () => {
|
|
||||||
expect(wrapper.find('div.gdd-transaction-list-item-name').text()).toBe('Bibi Bloxberg')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('has a link', () => {
|
|
||||||
expect(wrapper.find('div.gdd-transaction-list-item-name').find('a').exists()).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('click link', () => {
|
|
||||||
beforeEach(async () => {
|
|
||||||
await wrapper.find('div.gdd-transaction-list-item-name').find('a').trigger('click')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('emits set tunneled email', () => {
|
|
||||||
expect(wrapper.emitted('set-tunneled-email')).toEqual([['bibi@bloxberg.de']])
|
|
||||||
})
|
|
||||||
|
|
||||||
it('pushes the route with query for email', () => {
|
|
||||||
expect(mocks.$router.push).toBeCalledWith({
|
|
||||||
path: '/send',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -10,21 +10,7 @@
|
|||||||
</b-col>
|
</b-col>
|
||||||
<b-col cols="7">
|
<b-col cols="7">
|
||||||
<div class="gdd-transaction-list-item-name">
|
<div class="gdd-transaction-list-item-name">
|
||||||
<span v-if="linkedUser && linkedUser.email">
|
<span>{{ text }}</span>
|
||||||
<b-link @click.stop="tunnelEmail">
|
|
||||||
{{ itemText }}
|
|
||||||
</b-link>
|
|
||||||
</span>
|
|
||||||
<span v-else>{{ itemText }}</span>
|
|
||||||
<span v-if="linkId">
|
|
||||||
{{ $t('via_link') }}
|
|
||||||
<b-icon
|
|
||||||
icon="link45deg"
|
|
||||||
variant="muted"
|
|
||||||
class="m-mb-1"
|
|
||||||
:title="$t('gdd_per_link.redeemed-title')"
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
@ -38,31 +24,9 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
linkedUser: {
|
|
||||||
type: Object,
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
text: {
|
text: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: true,
|
||||||
},
|
|
||||||
linkId: {
|
|
||||||
type: Number,
|
|
||||||
required: false,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
tunnelEmail() {
|
|
||||||
this.$emit('set-tunneled-email', this.linkedUser.email)
|
|
||||||
this.$router.push({ path: '/send' })
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
itemText() {
|
|
||||||
return this.linkedUser
|
|
||||||
? this.linkedUser.firstName + ' ' + this.linkedUser.lastName
|
|
||||||
: this.text
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,6 @@ describe('UserCard_Newsletter', () => {
|
|||||||
$store: {
|
$store: {
|
||||||
state: {
|
state: {
|
||||||
language: 'de',
|
language: 'de',
|
||||||
email: 'peter@lustig.de',
|
|
||||||
newsletterState: true,
|
newsletterState: true,
|
||||||
},
|
},
|
||||||
commit: storeCommitMock,
|
commit: storeCommitMock,
|
||||||
|
|||||||
@ -145,7 +145,6 @@ export const login = gql`
|
|||||||
mutation($email: String!, $password: String!, $publisherId: Int) {
|
mutation($email: String!, $password: String!, $publisherId: Int) {
|
||||||
login(email: $email, password: $password, publisherId: $publisherId) {
|
login(email: $email, password: $password, publisherId: $publisherId) {
|
||||||
gradidoID
|
gradidoID
|
||||||
email
|
|
||||||
firstName
|
firstName
|
||||||
lastName
|
lastName
|
||||||
language
|
language
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import gql from 'graphql-tag'
|
|||||||
export const verifyLogin = gql`
|
export const verifyLogin = gql`
|
||||||
query {
|
query {
|
||||||
verifyLogin {
|
verifyLogin {
|
||||||
email
|
gradidoID
|
||||||
firstName
|
firstName
|
||||||
lastName
|
lastName
|
||||||
language
|
language
|
||||||
@ -40,7 +40,6 @@ export const transactionsQuery = gql`
|
|||||||
firstName
|
firstName
|
||||||
lastName
|
lastName
|
||||||
gradidoID
|
gradidoID
|
||||||
email
|
|
||||||
}
|
}
|
||||||
decay {
|
decay {
|
||||||
decay
|
decay
|
||||||
@ -102,9 +101,9 @@ export const queryTransactionLink = gql`
|
|||||||
redeemedAt
|
redeemedAt
|
||||||
deletedAt
|
deletedAt
|
||||||
user {
|
user {
|
||||||
|
gradidoID
|
||||||
firstName
|
firstName
|
||||||
publisherId
|
publisherId
|
||||||
email
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
... on ContributionLink {
|
... on ContributionLink {
|
||||||
|
|||||||
@ -43,7 +43,6 @@ const mocks = {
|
|||||||
$store: {
|
$store: {
|
||||||
dispatch: storeDispatchMock,
|
dispatch: storeDispatchMock,
|
||||||
state: {
|
state: {
|
||||||
email: 'user@example.org',
|
|
||||||
publisherId: 123,
|
publisherId: 123,
|
||||||
firstName: 'User',
|
firstName: 'User',
|
||||||
lastName: 'Example',
|
lastName: 'Example',
|
||||||
@ -260,34 +259,6 @@ describe('DashboardLayout', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe.skip('elopage URI', () => {
|
|
||||||
describe('user has no publisher ID and no elopage', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
mocks.$store.state.publisherId = null
|
|
||||||
mocks.$store.state.hasElopage = false
|
|
||||||
wrapper = Wrapper()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('links to basic-de', () => {
|
|
||||||
expect(wrapper.vm.elopageUri).toBe(
|
|
||||||
'https://elopage.com/s/gradido/basic-de/payment?locale=en&prid=111&pid=2896&firstName=User&lastName=Example&email=user@example.org',
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('user has elopage', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
mocks.$store.state.publisherId = '123'
|
|
||||||
mocks.$store.state.hasElopage = true
|
|
||||||
wrapper = Wrapper()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('links to sign in for elopage', () => {
|
|
||||||
expect(wrapper.vm.elopageUri).toBe('https://elopage.com/s/gradido/sign_in?locale=en')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe.skip('admin method', () => {
|
describe.skip('admin method', () => {
|
||||||
const windowLocationMock = jest.fn()
|
const windowLocationMock = jest.fn()
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -32,7 +32,7 @@ apolloQueryMock.mockResolvedValue({
|
|||||||
validUntil: transactionLinkValidExpireDate(),
|
validUntil: transactionLinkValidExpireDate(),
|
||||||
redeemedAt: '2022-03-18T10:08:43.000Z',
|
redeemedAt: '2022-03-18T10:08:43.000Z',
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
user: { firstName: 'Bibi', publisherId: 0, email: 'bibi@bloxberg.de' },
|
user: { firstName: 'Bibi', publisherId: 0, gradidoID: 'other-user-id' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -44,7 +44,7 @@ const mocks = {
|
|||||||
state: {
|
state: {
|
||||||
token: null,
|
token: null,
|
||||||
tokenTime: null,
|
tokenTime: null,
|
||||||
email: 'bibi@bloxberg.de',
|
gradidoID: 'current-user-id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
$apollo: {
|
$apollo: {
|
||||||
@ -101,7 +101,7 @@ describe('TransactionLink', () => {
|
|||||||
validUntil: transactionLinkValidExpireDate(),
|
validUntil: transactionLinkValidExpireDate(),
|
||||||
redeemedAt: '2022-03-18T10:08:43.000Z',
|
redeemedAt: '2022-03-18T10:08:43.000Z',
|
||||||
deletedAt: now,
|
deletedAt: now,
|
||||||
user: { firstName: 'Bibi', publisherId: 0, email: 'bibi@bloxberg.de' },
|
user: { firstName: 'Bibi', publisherId: 0, gradidoID: 'other-user-id' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -132,7 +132,7 @@ describe('TransactionLink', () => {
|
|||||||
validUntil: '2020-03-18T10:08:43.000Z',
|
validUntil: '2020-03-18T10:08:43.000Z',
|
||||||
redeemedAt: '2022-03-18T10:08:43.000Z',
|
redeemedAt: '2022-03-18T10:08:43.000Z',
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
user: { firstName: 'Bibi', publisherId: 0, email: 'bibi@bloxberg.de' },
|
user: { firstName: 'Bibi', publisherId: 0, gradidoID: 'other-user-id' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -163,7 +163,7 @@ describe('TransactionLink', () => {
|
|||||||
validUntil: transactionLinkValidExpireDate(),
|
validUntil: transactionLinkValidExpireDate(),
|
||||||
redeemedAt: '2022-03-18T10:08:43.000Z',
|
redeemedAt: '2022-03-18T10:08:43.000Z',
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
user: { firstName: 'Bibi', publisherId: 0, email: 'bibi@bloxberg.de' },
|
user: { firstName: 'Bibi', publisherId: 0, gradidoID: 'other-user-id' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -195,7 +195,7 @@ describe('TransactionLink', () => {
|
|||||||
validUntil: transactionLinkValidExpireDate(),
|
validUntil: transactionLinkValidExpireDate(),
|
||||||
redeemedAt: null,
|
redeemedAt: null,
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
user: { firstName: 'Bibi', publisherId: 0, email: 'bibi@bloxberg.de' },
|
user: { firstName: 'Bibi', publisherId: 0, gradidoID: 'other-user-id' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -239,7 +239,7 @@ describe('TransactionLink', () => {
|
|||||||
validUntil: transactionLinkValidExpireDate(),
|
validUntil: transactionLinkValidExpireDate(),
|
||||||
redeemedAt: null,
|
redeemedAt: null,
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
user: { firstName: 'Bibi', publisherId: 0, email: 'bibi@bloxberg.de' },
|
user: { firstName: 'Bibi', publisherId: 0, gradidoID: 'current-user-id' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -275,7 +275,7 @@ describe('TransactionLink', () => {
|
|||||||
validUntil: transactionLinkValidExpireDate(),
|
validUntil: transactionLinkValidExpireDate(),
|
||||||
redeemedAt: null,
|
redeemedAt: null,
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
user: { firstName: 'Peter', publisherId: 0, email: 'peter@listig.de' },
|
user: { firstName: 'Peter', publisherId: 0, gradidoID: 'other-user-id' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -351,7 +351,7 @@ describe('TransactionLink', () => {
|
|||||||
validUntil: transactionLinkValidExpireDate(),
|
validUntil: transactionLinkValidExpireDate(),
|
||||||
redeemedAt: null,
|
redeemedAt: null,
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
user: { firstName: 'Bibi', publisherId: 0, email: 'bibi@bloxberg.de' },
|
user: { firstName: 'Bibi', publisherId: 0, gradidoID: 'other-user-id' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@ -139,7 +139,7 @@ export default {
|
|||||||
if (this.tokenExpiresInSeconds < 5) return `LOGGED_OUT`
|
if (this.tokenExpiresInSeconds < 5) return `LOGGED_OUT`
|
||||||
|
|
||||||
// logged in, nicht berechtigt einzulösen, eigener link
|
// logged in, nicht berechtigt einzulösen, eigener link
|
||||||
if (this.linkData.user && this.$store.state.email === this.linkData.user.email) {
|
if (this.linkData.user && this.$store.state.gradidoID === this.linkData.user.gradidoID) {
|
||||||
return `SELF_CREATOR`
|
return `SELF_CREATOR`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,8 +13,8 @@ export const mutations = {
|
|||||||
localeChanged(language)
|
localeChanged(language)
|
||||||
state.language = language
|
state.language = language
|
||||||
},
|
},
|
||||||
email: (state, email) => {
|
gradidoID: (state, gradidoID) => {
|
||||||
state.email = email
|
state.gradidoID = gradidoID
|
||||||
},
|
},
|
||||||
// username: (state, username) => {
|
// username: (state, username) => {
|
||||||
// state.username = username
|
// state.username = username
|
||||||
@ -57,7 +57,7 @@ export const mutations = {
|
|||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
login: ({ dispatch, commit }, data) => {
|
login: ({ dispatch, commit }, data) => {
|
||||||
commit('email', data.email)
|
commit('gradidoID', data.gradidoID)
|
||||||
commit('language', data.language)
|
commit('language', data.language)
|
||||||
// commit('username', data.username)
|
// commit('username', data.username)
|
||||||
commit('firstName', data.firstName)
|
commit('firstName', data.firstName)
|
||||||
@ -71,8 +71,8 @@ export const actions = {
|
|||||||
},
|
},
|
||||||
logout: ({ commit, state }) => {
|
logout: ({ commit, state }) => {
|
||||||
commit('token', null)
|
commit('token', null)
|
||||||
commit('email', null)
|
|
||||||
// commit('username', '')
|
// commit('username', '')
|
||||||
|
commit('gradidoID', null)
|
||||||
commit('firstName', '')
|
commit('firstName', '')
|
||||||
commit('lastName', '')
|
commit('lastName', '')
|
||||||
commit('newsletterState', null)
|
commit('newsletterState', null)
|
||||||
@ -96,8 +96,8 @@ try {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
state: {
|
state: {
|
||||||
email: '',
|
|
||||||
language: null,
|
language: null,
|
||||||
|
gradidoID: null,
|
||||||
firstName: '',
|
firstName: '',
|
||||||
lastName: '',
|
lastName: '',
|
||||||
// username: '',
|
// username: '',
|
||||||
|
|||||||
@ -22,7 +22,7 @@ i18n.locale = 'blubb'
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
language,
|
language,
|
||||||
email,
|
gradidoID,
|
||||||
token,
|
token,
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
@ -53,11 +53,11 @@ describe('Vuex store', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('email', () => {
|
describe('gradidoID', () => {
|
||||||
it('sets the state of email', () => {
|
it('sets the state of gradidoID', () => {
|
||||||
const state = { email: 'nobody@knows.tv' }
|
const state = { gradidoID: 'old-id' }
|
||||||
email(state, 'someone@there.is')
|
gradidoID(state, 'new-id')
|
||||||
expect(state.email).toEqual('someone@there.is')
|
expect(state.gradidoID).toEqual('new-id')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ describe('Vuex store', () => {
|
|||||||
const commit = jest.fn()
|
const commit = jest.fn()
|
||||||
const state = {}
|
const state = {}
|
||||||
const commitedData = {
|
const commitedData = {
|
||||||
email: 'user@example.org',
|
gradidoID: 'my-gradido-id',
|
||||||
language: 'de',
|
language: 'de',
|
||||||
firstName: 'Peter',
|
firstName: 'Peter',
|
||||||
lastName: 'Lustig',
|
lastName: 'Lustig',
|
||||||
@ -183,9 +183,9 @@ describe('Vuex store', () => {
|
|||||||
expect(commit).toHaveBeenCalledTimes(10)
|
expect(commit).toHaveBeenCalledTimes(10)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('commits email', () => {
|
it('commits gradidoID', () => {
|
||||||
login({ commit, state }, commitedData)
|
login({ commit, state }, commitedData)
|
||||||
expect(commit).toHaveBeenNthCalledWith(1, 'email', 'user@example.org')
|
expect(commit).toHaveBeenNthCalledWith(1, 'gradidoID', 'my-gradido-id')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('commits language', () => {
|
it('commits language', () => {
|
||||||
@ -248,9 +248,9 @@ describe('Vuex store', () => {
|
|||||||
expect(commit).toHaveBeenNthCalledWith(1, 'token', null)
|
expect(commit).toHaveBeenNthCalledWith(1, 'token', null)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('commits email', () => {
|
it('commits gradidoID', () => {
|
||||||
logout({ commit, state })
|
logout({ commit, state })
|
||||||
expect(commit).toHaveBeenNthCalledWith(2, 'email', null)
|
expect(commit).toHaveBeenNthCalledWith(2, 'gradidoID', null)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('commits firstName', () => {
|
it('commits firstName', () => {
|
||||||
|
|||||||
@ -64,5 +64,5 @@ module.exports = {
|
|||||||
// Enable CSS source maps.
|
// Enable CSS source maps.
|
||||||
sourceMap: CONFIG.NODE_ENV !== 'production',
|
sourceMap: CONFIG.NODE_ENV !== 'production',
|
||||||
},
|
},
|
||||||
outputDir: path.resolve(__dirname, './dist'),
|
outputDir: path.resolve(__dirname, './build'),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ server {
|
|||||||
|
|
||||||
# TODO this could be a performance optimization
|
# TODO this could be a performance optimization
|
||||||
#location /vue {
|
#location /vue {
|
||||||
# alias /var/www/html/gradido/frontend/dist;
|
# alias /var/www/html/gradido/frontend/build;
|
||||||
# index index.html;
|
# index index.html;
|
||||||
#
|
#
|
||||||
# location ~* \.(png)$ {
|
# location ~* \.(png)$ {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user