Merge branch 'master' into update-license-in-package-json

This commit is contained in:
Moriz Wahl 2022-05-31 09:18:45 +02:00 committed by GitHub
commit 625867514c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 130 additions and 390 deletions

View File

@ -13,6 +13,14 @@
{
"type": "dateFile",
"filename": "../logs/backend/apollo.log",
"pattern": "%d{ISO8601} %p %c %m",
"keepFileExt" : true,
"fileNameSep" : "_"
},
"backend":
{
"type": "dateFile",
"filename": "../logs/backend/backend.log",
"pattern": "%d{ISO8601} %p %c %X{user} %f:%l %m",
"keepFileExt" : true,
"fileNameSep" : "_"
@ -31,24 +39,52 @@
"level": "error",
"appender": "errorFile"
},
"out":
"out":
{
"type": "stdout",
"layout":
{
"type": "pattern", "pattern": "%d{ISO8601} %p %c %X{user} %f:%l %m"
}
}
},
"apolloOut":
{
"type": "stdout",
"layout":
{
"type": "pattern", "pattern": "%d{ISO8601} %p %c %m"
}
}
},
"categories":
"categories":
{
"default":
{
"appenders":
[
"out",
"errors"
],
"level": "debug",
"enableCallStack": true
},
"apollo":
{
"appenders":
[
"apollo",
"apolloOut",
"errors"
],
"level": "debug",
"enableCallStack": true
},
"backend":
{
"appenders":
[
"backend",
"out",
"errors"
],
"level": "debug",

View File

@ -19,7 +19,4 @@ export default class UpdateUserInfosArgs {
@Field({ nullable: true })
passwordNew?: string
@Field({ nullable: true })
coinanimation?: boolean
}

View File

@ -1,5 +0,0 @@
enum Setting {
COIN_ANIMATION = 'coinanimation',
}
export { Setting }

View File

@ -15,8 +15,6 @@ export class User {
this.language = user.language
this.publisherId = user.publisherId
this.isAdmin = user.isAdmin
// TODO
this.coinanimation = null
this.klickTipp = null
this.hasElopage = null
}
@ -61,11 +59,6 @@ export class User {
@Field(() => Date, { nullable: true })
isAdmin: Date | null
// TODO this is a bit inconsistent with what we query from the database
// therefore all those fields are now nullable with default value null
@Field(() => Boolean, { nullable: true })
coinanimation: boolean | null
@Field(() => KlickTipp, { nullable: true })
klickTipp: KlickTipp | null

View File

@ -344,7 +344,6 @@ describe('UserResolver', () => {
expect.objectContaining({
data: {
login: {
coinanimation: true,
email: 'bibi@bloxberg.de',
firstName: 'Bibi',
hasElopage: false,
@ -479,7 +478,6 @@ describe('UserResolver', () => {
firstName: 'Bibi',
lastName: 'Bloxberg',
language: 'de',
coinanimation: true,
klickTipp: {
newsletterState: false,
},

View File

@ -3,7 +3,7 @@ import { backendLogger as logger } from '@/server/logger'
import { Context, getUser } from '@/server/context'
import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware, Mutation } from 'type-graphql'
import { getConnection, getCustomRepository } from '@dbTools/typeorm'
import { getConnection } from '@dbTools/typeorm'
import CONFIG from '@/config'
import { User } from '@model/User'
import { User as DbUser } from '@entity/User'
@ -13,8 +13,6 @@ import CreateUserArgs from '@arg/CreateUserArgs'
import UnsecureLoginArgs from '@arg/UnsecureLoginArgs'
import UpdateUserInfosArgs from '@arg/UpdateUserInfosArgs'
import { klicktippNewsletterStateMiddleware } from '@/middleware/klicktippMiddleware'
import { UserSettingRepository } from '@repository/UserSettingRepository'
import { Setting } from '@enum/Setting'
import { OptInType } from '@enum/OptInType'
import { LoginEmailOptIn } from '@entity/LoginEmailOptIn'
import { sendResetPasswordEmail as sendResetPasswordEmailMailer } from '@/mailer/sendResetPasswordEmail'
@ -228,15 +226,6 @@ export class UserResolver {
// Elopage Status & Stored PublisherId
user.hasElopage = await this.hasElopage(context)
// coinAnimation
const userSettingRepository = getCustomRepository(UserSettingRepository)
const coinanimation = await userSettingRepository
.readBoolean(userEntity.id, Setting.COIN_ANIMATION)
.catch((error) => {
logger.error('error:', error)
throw new Error(error)
})
user.coinanimation = coinanimation
logger.debug(`verifyLogin... successful: ${user.firstName}.${user.lastName}, ${user.email}`)
return user
}
@ -294,15 +283,6 @@ export class UserResolver {
DbUser.save(dbUser)
}
// coinAnimation
const userSettingRepository = getCustomRepository(UserSettingRepository)
const coinanimation = await userSettingRepository
.readBoolean(dbUser.id, Setting.COIN_ANIMATION)
.catch((error) => {
throw new Error(error)
})
user.coinanimation = coinanimation
context.setHeaders.push({
key: 'token',
value: encode(dbUser.pubKey),
@ -598,12 +578,10 @@ export class UserResolver {
@Mutation(() => Boolean)
async updateUserInfos(
@Args()
{ firstName, lastName, language, password, passwordNew, coinanimation }: UpdateUserInfosArgs,
{ firstName, lastName, language, password, passwordNew }: UpdateUserInfosArgs,
@Ctx() context: Context,
): Promise<boolean> {
logger.info(
`updateUserInfos(${firstName}, ${lastName}, ${language}, ***, ***, ${coinanimation})...`,
)
logger.info(`updateUserInfos(${firstName}, ${lastName}, ${language}, ***, ***)...`)
const userEntity = getUser(context)
if (firstName) {
@ -655,15 +633,6 @@ export class UserResolver {
await queryRunner.startTransaction('READ UNCOMMITTED')
try {
if (coinanimation !== null && coinanimation !== undefined) {
queryRunner.manager
.getCustomRepository(UserSettingRepository)
.setOrUpdate(userEntity.id, Setting.COIN_ANIMATION, coinanimation.toString())
.catch((error) => {
throw new Error('error saving coinanimation: ' + error)
})
}
await queryRunner.manager.save(userEntity).catch((error) => {
throw new Error('error saving user: ' + error)
})

View File

@ -31,7 +31,6 @@ export const updateUserInfos = gql`
$password: String
$passwordNew: String
$locale: String
$coinanimation: Boolean
) {
updateUserInfos(
firstName: $firstName
@ -39,7 +38,6 @@ export const updateUserInfos = gql`
password: $password
passwordNew: $passwordNew
language: $locale
coinanimation: $coinanimation
)
}
`

View File

@ -8,7 +8,6 @@ export const login = gql`
firstName
lastName
language
coinanimation
klickTipp {
newsletterState
}
@ -26,7 +25,6 @@ export const verifyLogin = gql`
firstName
lastName
language
coinanimation
klickTipp {
newsletterState
}

View File

@ -12,7 +12,6 @@ log4js.configure(options)
const apolloLogger = log4js.getLogger('apollo')
const backendLogger = log4js.getLogger('backend')
apolloLogger.addContext('user', 'unknown')
backendLogger.addContext('user', 'unknown')
export { apolloLogger, backendLogger }

View File

@ -32,16 +32,16 @@ const logPlugin = {
requestDidStart(requestContext: any) {
const { logger } = requestContext
const { query, mutation, variables } = requestContext.request
logger.trace(`Request:
logger.info(`Request:
${mutation || query}variables: ${JSON.stringify(filterVariables(variables), null, 2)}`)
return {
willSendResponse(requestContext: any) {
if (requestContext.context.user) logger.trace(`User ID: ${requestContext.context.user.id}`)
if (requestContext.context.user) logger.info(`User ID: ${requestContext.context.user.id}`)
if (requestContext.response.data)
logger.trace(`Response-Data:
logger.info(`Response-Data:
${JSON.stringify(requestContext.response.data, null, 2)}`)
if (requestContext.response.errors)
logger.trace(`Response-Errors:
logger.error(`Response-Errors:
${JSON.stringify(requestContext.response.errors, null, 2)}`)
return requestContext
},

View File

@ -1,33 +1,22 @@
import { EntityRepository, Repository } from '@dbTools/typeorm'
import { UserSetting } from '@entity/UserSetting'
import { Setting } from '@enum/Setting'
import { isStringBoolean } from '@/util/validate'
@EntityRepository(UserSetting)
export class UserSettingRepository extends Repository<UserSetting> {
async setOrUpdate(userId: number, key: Setting, value: string): Promise<UserSetting> {
switch (key) {
case Setting.COIN_ANIMATION:
if (!isStringBoolean(value)) {
throw new Error("coinanimation value isn't boolean")
}
break
default:
throw new Error("key isn't defined: " + key)
}
let entity = await this.findOne({ userId: userId, key: key })
async setOrUpdate(userId: number, value: string): Promise<UserSetting> {
let entity = await this.findOne({ userId: userId })
if (!entity) {
entity = new UserSetting()
entity.userId = userId
entity.key = key
}
entity.value = value
return this.save(entity)
}
async readBoolean(userId: number, key: Setting): Promise<boolean> {
const entity = await this.findOne({ userId: userId, key: key })
async readBoolean(userId: number): Promise<boolean> {
const entity = await this.findOne({ userId: userId })
if (!entity || !isStringBoolean(entity.value)) {
return true
}

View File

@ -0,0 +1 @@
<mxfile host="Electron" modified="2022-05-23T15:29:00.513Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.0.2 Chrome/96.0.4664.55 Electron/16.0.5 Safari/537.36" etag="IpEbe50ld79E_2HLyFXN" version="16.0.2" type="device"><diagram id="LWCFUfVkWozhiXBGj4Ze" name="Page-1">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</diagram></mxfile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 791 KiB

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 KiB

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 KiB

View File

@ -17,10 +17,17 @@ body {
/* Navbar */
a,
.navbar-light .navbar-nav .nav-link {
.navbar-light,
.navbar-nav,
.nav-link {
color: #047006;
}
a:hover,
.nav-link:hover {
color: #383838 !important;
}
.navbar-light .navbar-nav .nav-link.active {
color: rgb(35 121 188 / 90%);
}
@ -36,13 +43,11 @@ a,
/* Button */
.btn {
border-radius: 25px;
padding-right: 50px;
padding-left: 50px;
}
.btn-gradido {
display: inline-block;
padding: 1em 3em;
padding: 0.6em 3em;
letter-spacing: 0.05em;
color: #fff;
transition: all 0.5s ease;
@ -50,6 +55,9 @@ a,
background: linear-gradient(135deg, rgb(249 205 105 / 100%) 2%, rgb(197 141 56 / 100%) 55%);
box-shadow: rgb(0 0 0 / 40%) 0 30px 90px;
border-radius: 26px;
padding-right: 50px;
padding-left: 50px;
border-style: none;
}
.btn-gradido:hover {
@ -62,7 +70,7 @@ a,
}
.btn-gradido-disable {
padding: 1em 3em;
padding: 0.6em 3em;
letter-spacing: 0.05em;
color: #fff;
transition: all 0.5s ease;
@ -70,6 +78,9 @@ a,
background: linear-gradient(135deg, rgb(180 180 180 / 100%) 46%, rgb(180 180 180 / 100%) 99%);
box-shadow: rgb(0 0 0 / 40%) 0 30px 90px;
border-radius: 26px;
padding-right: 50px;
padding-left: 50px;
border-style: none;
}
.btn-gradido-disable:hover {

View File

@ -1,10 +1,9 @@
<template>
<div>
<b-carousel :interval="3000">
<b-carousel :interval="13000">
<b-carousel-slide img-src="/img/template/Foto_01_2400_small.jpg"></b-carousel-slide>
<b-carousel-slide img-src="/img/template/Foto_02_2400_small.jpg"></b-carousel-slide>
<b-carousel-slide img-src="/img/template/Foto_03_2400_small.jpg"></b-carousel-slide>
<b-carousel-slide img-src="/img/template/Foto_04_2400_small.jpg"></b-carousel-slide>
</b-carousel>
</div>
</template>
@ -25,5 +24,10 @@ export default {
.carousel-inner {
height: 100%;
border-radius: 0% 49% 49% 0% / 0% 51% 49% 0%;
-webkit-border-radius: 0% 49% 49% 0% / 0% 51% 49% 0%;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<footer class="footer bg-transparent">
<footer class="footer">
<b-row class="mt-lg-7 mt-md-6 mt-4">
<b-col class="col-12 col-md-12 col-lg-6">
<div
@ -16,24 +16,32 @@
</div>
</b-col>
<b-col class="col-12 col-md-12 col-lg-6 mt-4 mb-4 mt-lg-0 mb-lg-0">
<div class="text-center ml-3 ml-lg-0 text-lg-right">
<div class="text-center ml-3 ml-lg-0 text-lg-right pt-1">
{{ $t('followUs') }}
<b-icon-facebook class="ml-3 mr-3" font-scale="1"></b-icon-facebook>
<b-icon-twitter class="mr-3" font-scale="1"></b-icon-twitter>
<b-icon-youtube class="mr-3" font-scale="1"></b-icon-youtube>
<b-link href="https://www.facebook.com/groups/Gradido/" target="_blank">
<b-icon-facebook class="ml-3 mr-3" font-scale="1"></b-icon-facebook>
</b-link>
<b-link href="https://twitter.com/gradido" target="_blank">
<b-icon-twitter class="mr-3" font-scale="1"></b-icon-twitter>
</b-link>
<b-link href="https://www.youtube.com/c/GradidoNet" target="_blank">
<b-icon-youtube class="mr-3" font-scale="1"></b-icon-youtube>
</b-link>
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="currentColor"
class="bi bi-telegram"
viewBox="0 0 16 16"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.287 5.906c-.778.324-2.334.994-4.666 2.01-.378.15-.577.298-.595.442-.03.243.275.339.69.47l.175.055c.408.133.958.288 1.243.294.26.006.549-.1.868-.32 2.179-1.471 3.304-2.214 3.374-2.23.05-.012.12-.026.166.016.047.041.042.12.037.141-.03.129-1.227 1.241-1.846 1.817-.193.18-.33.307-.358.336a8.154 8.154 0 0 1-.188.186c-.38.366-.664.64.015 1.088.327.216.589.393.85.571.284.194.568.387.936.629.093.06.183.125.27.187.331.236.63.448.997.414.214-.02.435-.22.547-.82.265-1.417.786-4.486.906-5.751a1.426 1.426 0 0 0-.013-.315.337.337 0 0 0-.114-.217.526.526 0 0 0-.31-.093c-.3.005-.763.166-2.984 1.09z"
/>
</svg>
<b-link href="https://t.me/Gradido" target="_blank">
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="currentColor"
class="bi bi-telegram"
viewBox="0 0 16 16"
>
<path
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.287 5.906c-.778.324-2.334.994-4.666 2.01-.378.15-.577.298-.595.442-.03.243.275.339.69.47l.175.055c.408.133.958.288 1.243.294.26.006.549-.1.868-.32 2.179-1.471 3.304-2.214 3.374-2.23.05-.012.12-.026.166.016.047.041.042.12.037.141-.03.129-1.227 1.241-1.846 1.817-.193.18-.33.307-.358.336a8.154 8.154 0 0 1-.188.186c-.38.366-.664.64.015 1.088.327.216.589.393.85.571.284.194.568.387.936.629.093.06.183.125.27.187.331.236.63.448.997.414.214-.02.435-.22.547-.82.265-1.417.786-4.486.906-5.751a1.426 1.426 0 0 0-.013-.315.337.337 0 0 0-.114-.217.526.526 0 0 0-.31-.093c-.3.005-.763.166-2.984 1.09z"
/>
</svg>
</b-link>
</div>
</b-col>
</b-row>

View File

@ -9,36 +9,36 @@
{{ $t('auth.left.newCurrency') }}
</div>
<img
src="img/template/Blaetter.png"
src="/img/template/Blaetter.png"
class="sheet-img position-absolute d-block d-lg-none zindex1000"
/>
<b-img
id="img0"
class="position-absolute zindex1000"
src="img/template/logo-header.png"
src="/img/template/logo-header.png"
alt="start background image"
></b-img>
<b-img
fluid
id="img1"
class="position-absolute h-100 w-100 overflow-hidden zindex100"
src="img/template/gold_03.png"
src="/img/template/gold_03.png"
alt="start background image"
></b-img>
<b-img
id="img2"
class="position-absolute zindex100"
src="img/template/gradido_background_header.png"
src="/img/template/gradido_background_header.png"
alt="start background image"
></b-img>
<b-img
id="img3"
class="position-relative zindex10"
src="img/template/Foto_01.jpg"
src="/img/template/Foto_01.jpg"
alt="start background image"
></b-img>
<div class="mobil-start-box-text position-fixed w-100 text-center zindex1000">
<b-button variant="gradido" to="/register" @click="$emit('is-mobile-start', false)">
<b-button variant="gradido" to="/register" @click="$emit('set-mobile-start', false)">
{{ $t('signup') }}
</b-button>
<div class="mt-3 h3 text-white">
@ -46,7 +46,7 @@
<b-link
to="/login"
class="text-gradido gradido-global-color-blue"
@click="$emit('is-mobile-start', false)"
@click="$emit('set-mobile-start', false)"
>
{{ $t('auth.left.hereLogin') }}
</b-link>
@ -58,6 +58,9 @@
<script>
export default {
name: 'AuthMobileStart',
props: {
mobileStart: { type: Boolean, default: false },
},
}
</script>

View File

@ -10,7 +10,7 @@
/>
<b-img
class="imgLogoBack mt--3 ml--3"
src="img/template/gradido_background_header.png"
src="/img/template/gradido_background_header.png"
width="230"
alt="start background image"
></b-img>
@ -37,8 +37,8 @@ export default {
name: 'AuthNavbar',
data() {
return {
logo: 'img/brand/green.png',
sheet: 'img/template/Blaetter.png',
logo: '/img/brand/green.png',
sheet: '/img/template/Blaetter.png',
}
},
}

View File

@ -1,127 +0,0 @@
import { mount } from '@vue/test-utils'
import UserCoinAnimation from './UserCoinAnimation'
import { updateUserInfos } from '@/graphql/mutations'
import { toastErrorSpy, toastSuccessSpy } from '@test/testSetup'
const localVue = global.localVue
const mockAPIcall = jest.fn()
const storeCommitMock = jest.fn()
describe('UserCard_CoinAnimation', () => {
let wrapper
const mocks = {
$t: jest.fn((t) => t),
$store: {
state: {
language: 'de',
coinanimation: true,
},
commit: storeCommitMock,
},
$apollo: {
mutate: mockAPIcall,
},
}
const Wrapper = () => {
return mount(UserCoinAnimation, { localVue, mocks })
}
describe('mount', () => {
beforeEach(() => {
jest.clearAllMocks()
wrapper = Wrapper()
})
it('renders the component', () => {
expect(wrapper.find('div#formusercoinanimation').exists()).toBeTruthy()
})
it('has an edit BFormCheckbox switch', () => {
expect(wrapper.find('.Test-BFormCheckbox').exists()).toBeTruthy()
})
describe('enable with success', () => {
beforeEach(async () => {
await wrapper.setData({ CoinAnimationStatus: false })
mockAPIcall.mockResolvedValue({
data: {
updateUserInfos: {
validValues: 1,
},
},
})
await wrapper.find('input').setChecked()
})
it('calls the updateUserInfos mutation', () => {
expect(mockAPIcall).toBeCalledWith({
mutation: updateUserInfos,
variables: {
coinanimation: true,
},
})
})
it('updates the store', () => {
expect(storeCommitMock).toBeCalledWith('coinanimation', true)
})
it('toasts a success message', () => {
expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.True')
})
})
describe('disable with success', () => {
beforeEach(async () => {
await wrapper.setData({ CoinAnimationStatus: true })
mockAPIcall.mockResolvedValue({
data: {
updateUserInfos: {
validValues: 1,
},
},
})
await wrapper.find('input').setChecked(false)
})
it('calls the subscribe mutation', () => {
expect(mockAPIcall).toBeCalledWith({
mutation: updateUserInfos,
variables: {
coinanimation: false,
},
})
})
it('updates the store', () => {
expect(storeCommitMock).toBeCalledWith('coinanimation', false)
})
it('toasts a success message', () => {
expect(toastSuccessSpy).toBeCalledWith('settings.coinanimation.False')
})
})
describe('disable with server error', () => {
beforeEach(() => {
mockAPIcall.mockRejectedValue({
message: 'Ouch',
})
wrapper.find('input').trigger('change')
})
it('resets the CoinAnimationStatus', () => {
expect(wrapper.vm.CoinAnimationStatus).toBeTruthy()
})
it('toasts an error message', () => {
expect(toastErrorSpy).toBeCalledWith('Ouch')
})
})
})
})

View File

@ -1,65 +0,0 @@
<template>
<b-card
id="formusercoinanimation"
class="bg-transparent gradido-custom-background gradido-no-border-radius"
>
<div>
<b-row class="mb-3">
<b-col class="mb-2 col-12">
<small>
<b>{{ $t('settings.coinanimation.coinanimation') }}</b>
</small>
</b-col>
<b-col class="col-12">
<b-form-checkbox
class="Test-BFormCheckbox"
v-model="CoinAnimationStatus"
name="check-button"
switch
@change="onSubmit"
>
{{
CoinAnimationStatus
? $t('settings.coinanimation.True')
: $t('settings.coinanimation.False')
}}
</b-form-checkbox>
</b-col>
</b-row>
</div>
</b-card>
</template>
<script>
import { updateUserInfos } from '@/graphql/mutations'
export default {
name: 'UserCoinAnimation',
data() {
return {
CoinAnimationStatus: this.$store.state.coinanimation,
}
},
methods: {
async onSubmit() {
this.$apollo
.mutate({
mutation: updateUserInfos,
variables: {
coinanimation: this.CoinAnimationStatus,
},
})
.then(() => {
this.$store.commit('coinanimation', this.CoinAnimationStatus)
this.toastSuccess(
this.CoinAnimationStatus
? this.$t('settings.coinanimation.True')
: this.$t('settings.coinanimation.False'),
)
})
.catch((error) => {
this.CoinAnimationStatus = this.$store.state.coinanimation
this.toastError(error.message)
})
},
},
}
</script>

View File

@ -31,7 +31,6 @@ export const updateUserInfos = gql`
$password: String
$passwordNew: String
$locale: String
$coinanimation: Boolean
) {
updateUserInfos(
firstName: $firstName
@ -39,7 +38,6 @@ export const updateUserInfos = gql`
password: $password
passwordNew: $passwordNew
language: $locale
coinanimation: $coinanimation
)
}
`

View File

@ -7,7 +7,6 @@ export const login = gql`
firstName
lastName
language
coinanimation
klickTipp {
newsletterState
}
@ -25,7 +24,6 @@ export const verifyLogin = gql`
firstName
lastName
language
coinanimation
klickTipp {
newsletterState
}

View File

@ -3,7 +3,7 @@
<auth-mobile-start
v-if="mobileStart"
class="d-inline d-lg-none zindex10000"
@is-mobile-start="setMobileStart"
@set-mobile-start="setMobileStart"
/>
<div class="h-100 align-middle">
<auth-navbar class="zindex10" />
@ -34,7 +34,7 @@
<div class="mb-0">{{ $t('1000thanks') }}</div>
</b-col>
<b-col cols="3" class="text-right d-none d-sm-none d-md-inline">
<b-avatar src="img/brand/gradido_coin●.png" size="6rem"></b-avatar>
<b-avatar src="/img/brand/gradido_coin●.png" size="6rem"></b-avatar>
</b-col>
</b-row>
<b-card no-body ref="pageFontSize" class="border-0 mt-4 gradido-custom-background">
@ -44,7 +44,7 @@
</b-col>
<b-col cols="2" class="text-right">
<div id="popover-target-1" class="pointer">
<b-img src="img/svg/type.svg" width="19" class="svgType"></b-img>
<b-img src="/img/svg/type.svg" width="19" class="svgType"></b-img>
</div>
<b-popover
target="popover-target-1"
@ -64,7 +64,7 @@
</b-row>
<b-row class="d-inline d-sm-inline d-md-none d-lg-none mb-3">
<b-col class="text-center">
<b-avatar src="img/brand/gradido_coin●.png" size="6rem"></b-avatar>
<b-avatar src="/img/brand/gradido_coin●.png" size="6rem"></b-avatar>
<b-row>
<b-col class="zindex1000 d-flex justify-content-center">
<auth-navbar-small />
@ -73,11 +73,11 @@
</b-col>
</b-row>
<b-card-body class="">
<router-view></router-view>
<router-view @set-mobile-start="setMobileStart"></router-view>
</b-card-body>
</b-card>
</div>
<auth-footer v-if="!$route.meta.hideFooter" class="pr-5"></auth-footer>
<auth-footer v-if="!$route.meta.hideFooter" class="pr-5 mb-5"></auth-footer>
</b-col>
</b-row>
<!-- <auth-layout-gdd />-->

View File

@ -186,11 +186,6 @@
"send_gdd": "GDD versenden",
"send_per_link": "GDD versenden per Link",
"settings": {
"coinanimation": {
"coinanimation": "Münzanimation",
"False": "Münzanimation ausgeschaltet",
"True": "Münzanimation eingeschaltet"
},
"language": {
"changeLanguage": "Sprache ändern",
"de": "Deutsch",

View File

@ -186,11 +186,6 @@
"send_gdd": "GDD send",
"send_per_link": "GDD send via link",
"settings": {
"coinanimation": {
"coinanimation": "Coin animation",
"False": "Coin animation disabled",
"True": "Coin animation enabled"
},
"language": {
"changeLanguage": "Change language",
"de": "Deutsch",

View File

@ -38,9 +38,5 @@ describe('Profile', () => {
it('has a user change newsletter form', () => {
expect(wrapper.findComponent({ name: 'UserNewsletter' }).exists()).toBeTruthy()
})
it('has a user change coin animation form', () => {
expect(wrapper.findComponent({ name: 'UserCoinAnimation' }).exists()).toBeTruthy()
})
})
})

View File

@ -8,8 +8,6 @@
<user-language />
<hr />
<user-newsletter />
<hr />
<user-coin-animation />
</div>
</template>
<script>
@ -18,7 +16,6 @@ import UserData from '@/components/UserSettings/UserData.vue'
import UserPassword from '@/components/UserSettings/UserPassword.vue'
import UserLanguage from '@/components/UserSettings/UserLanguage.vue'
import UserNewsletter from '@/components/UserSettings/UserNewsletter.vue'
import UserCoinAnimation from '@/components/UserSettings/UserCoinAnimation.vue'
export default {
name: 'Profile',
@ -28,7 +25,6 @@ export default {
UserPassword,
UserLanguage,
UserNewsletter,
UserCoinAnimation,
},
props: {
balance: { type: Number, default: 0 },

View File

@ -79,16 +79,6 @@ describe('ResetPassword', () => {
expect(wrapper.find('div.resetpwd-form').exists()).toBeTruthy()
})
describe('links', () => {
it('has a link "Back"', async () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual('back')
})
it('links to /login when clicking "Back"', async () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to).toBe('/login')
})
})
describe('reset password form', () => {
it('has a register form', async () => {
expect(wrapper.find('form').exists()).toBeTruthy()

View File

@ -5,19 +5,13 @@
<b-form role="form" @submit.prevent="handleSubmit(onSubmit)">
<input-password-confirmation v-model="form" />
<div class="text-center">
<b-button type="submit" variant="primary" class="mt-4">
<b-button type="submit" variant="gradido" class="mt-4">
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
{{ $t(displaySetup.button) }}
</b-button>
</div>
</b-form>
</validation-observer>
<b-row v-if="displaySetup.linkTo">
<b-col class="text-center py-lg-4">
<router-link :to="displaySetup.linkTo" class="mt-3">{{ $t('back') }}</router-link>
</b-col>
</b-row>
</div>
</template>
@ -39,10 +33,6 @@ const textFields = {
button: 'settings.password.set',
linkTo: '/login',
},
login: {
headline: 'site.thx.errorTitle',
subtitle: 'site.thx.activateEmail',
},
}
export default {
@ -116,6 +106,7 @@ export default {
},
},
created() {
this.$emit('set-mobile-start', false)
this.setDisplaySetup()
},
}

View File

@ -38,9 +38,6 @@ export const mutations = {
isAdmin: (state, isAdmin) => {
state.isAdmin = !!isAdmin
},
coinanimation: (state, coinanimation) => {
state.coinanimation = coinanimation
},
hasElopage: (state, hasElopage) => {
state.hasElopage = hasElopage
},
@ -53,7 +50,6 @@ export const actions = {
// commit('username', data.username)
commit('firstName', data.firstName)
commit('lastName', data.lastName)
commit('coinanimation', data.coinanimation)
commit('newsletterState', data.klickTipp.newsletterState)
commit('hasElopage', data.hasElopage)
commit('publisherId', data.publisherId)
@ -65,7 +61,6 @@ export const actions = {
// commit('username', '')
commit('firstName', '')
commit('lastName', '')
commit('coinanimation', true)
commit('newsletterState', null)
commit('hasElopage', false)
commit('publisherId', null)
@ -91,7 +86,6 @@ try {
// username: '',
token: null,
isAdmin: false,
coinanimation: true,
newsletterState: null,
hasElopage: false,
publisherId: null,

View File

@ -20,7 +20,6 @@ const {
token,
firstName,
lastName,
coinanimation,
newsletterState,
publisherId,
isAdmin,
@ -78,14 +77,6 @@ describe('Vuex store', () => {
})
})
describe('coinanimation', () => {
it('sets the state of coinanimation', () => {
const state = { coinanimation: true }
coinanimation(state, false)
expect(state.coinanimation).toEqual(false)
})
})
describe('newsletterState', () => {
it('sets the state of newsletterState', () => {
const state = { newsletterState: null }
@ -134,7 +125,6 @@ describe('Vuex store', () => {
language: 'de',
firstName: 'Peter',
lastName: 'Lustig',
coinanimation: false,
klickTipp: {
newsletterState: true,
},
@ -145,7 +135,7 @@ describe('Vuex store', () => {
it('calls nine commits', () => {
login({ commit, state }, commitedData)
expect(commit).toHaveBeenCalledTimes(9)
expect(commit).toHaveBeenCalledTimes(8)
})
it('commits email', () => {
@ -168,29 +158,24 @@ describe('Vuex store', () => {
expect(commit).toHaveBeenNthCalledWith(4, 'lastName', 'Lustig')
})
it('commits coinanimation', () => {
login({ commit, state }, commitedData)
expect(commit).toHaveBeenNthCalledWith(5, 'coinanimation', false)
})
it('commits newsletterState', () => {
login({ commit, state }, commitedData)
expect(commit).toHaveBeenNthCalledWith(6, 'newsletterState', true)
expect(commit).toHaveBeenNthCalledWith(5, 'newsletterState', true)
})
it('commits hasElopage', () => {
login({ commit, state }, commitedData)
expect(commit).toHaveBeenNthCalledWith(7, 'hasElopage', false)
expect(commit).toHaveBeenNthCalledWith(6, 'hasElopage', false)
})
it('commits publisherId', () => {
login({ commit, state }, commitedData)
expect(commit).toHaveBeenNthCalledWith(8, 'publisherId', 1234)
expect(commit).toHaveBeenNthCalledWith(7, 'publisherId', 1234)
})
it('commits isAdmin', () => {
login({ commit, state }, commitedData)
expect(commit).toHaveBeenNthCalledWith(9, 'isAdmin', true)
expect(commit).toHaveBeenNthCalledWith(8, 'isAdmin', true)
})
})
@ -200,7 +185,7 @@ describe('Vuex store', () => {
it('calls nine commits', () => {
logout({ commit, state })
expect(commit).toHaveBeenCalledTimes(9)
expect(commit).toHaveBeenCalledTimes(8)
})
it('commits token', () => {
@ -223,29 +208,24 @@ describe('Vuex store', () => {
expect(commit).toHaveBeenNthCalledWith(4, 'lastName', '')
})
it('commits coinanimation', () => {
logout({ commit, state })
expect(commit).toHaveBeenNthCalledWith(5, 'coinanimation', true)
})
it('commits newsletterState', () => {
logout({ commit, state })
expect(commit).toHaveBeenNthCalledWith(6, 'newsletterState', null)
expect(commit).toHaveBeenNthCalledWith(5, 'newsletterState', null)
})
it('commits hasElopage', () => {
logout({ commit, state })
expect(commit).toHaveBeenNthCalledWith(7, 'hasElopage', false)
expect(commit).toHaveBeenNthCalledWith(6, 'hasElopage', false)
})
it('commits publisherId', () => {
logout({ commit, state })
expect(commit).toHaveBeenNthCalledWith(8, 'publisherId', null)
expect(commit).toHaveBeenNthCalledWith(7, 'publisherId', null)
})
it('commits isAdmin', () => {
logout({ commit, state })
expect(commit).toHaveBeenNthCalledWith(9, 'isAdmin', false)
expect(commit).toHaveBeenNthCalledWith(8, 'isAdmin', false)
})
// how to get this working?