Merge branch 'master' into admin_fix_formatting_issues

This commit is contained in:
einhornimmond 2025-03-28 23:31:15 +01:00 committed by GitHub
commit d889b61ad3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 392 additions and 101 deletions

View File

@ -2,7 +2,8 @@
JWT_EXPIRES_IN=2m
GDT_ACTIVE=false
OPENAI_ACTIVE=false
HUMHUB_ACTIVE=false
GMS_ACTIVE=false
# Email
EMAIL=true

View File

@ -1,10 +1,14 @@
import { Point } from '@dbTools/typeorm'
import { User as dbUser } from '@entity/User'
import { ObjectType, Field, Int } from 'type-graphql'
import { GmsPublishLocationType } from '@enum/GmsPublishLocationType'
import { PublishNameType } from '@enum/PublishNameType'
import { Point2Location } from '@/graphql/resolver/util/Location2Point'
import { KlickTipp } from './KlickTipp'
import { Location } from './Location'
@ObjectType()
export class User {
@ -37,6 +41,7 @@ export class User {
this.gmsPublishName = user.gmsPublishName
this.humhubPublishName = user.humhubPublishName
this.gmsPublishLocation = user.gmsPublishLocation
this.userLocation = user.location ? Point2Location(user.location as Point) : null
}
}
@ -109,4 +114,7 @@ export class User {
@Field(() => [String])
roles: string[]
@Field(() => Location, { nullable: true })
userLocation: Location | null
}

View File

@ -485,7 +485,6 @@ describe('UserResolver', () => {
})
transactionLink = await TransactionLink.findOneOrFail({ where: { userId: bob.id } })
resetToken()
// create new user using transaction link of bob
@ -504,7 +503,7 @@ describe('UserResolver', () => {
UserContact.findOne({ where: { email: 'which@ever.de' }, relations: ['user'] }),
).resolves.toEqual(
expect.objectContaining({
user: expect.objectContaining({ referrerId: bob.data.login.id }),
user: expect.objectContaining({ referrerId: transactionLink.userId }), // bob.data.login.id }),
}),
)
})
@ -721,9 +720,17 @@ describe('UserResolver', () => {
expect.objectContaining({
data: {
login: {
alias: 'BBB',
firstName: 'Bibi',
gmsAllowed: true,
gmsPublishLocation: 'GMS_LOCATION_TYPE_RANDOM',
gmsPublishName: 'PUBLISH_NAME_ALIAS_OR_INITALS',
gradidoID: expect.any(String),
hasElopage: false,
id: expect.any(Number),
hideAmountGDD: false,
hideAmountGDT: false,
humhubAllowed: true,
humhubPublishName: 'PUBLISH_NAME_ALIAS_OR_INITALS',
klickTipp: {
newsletterState: false,
},
@ -731,6 +738,7 @@ describe('UserResolver', () => {
lastName: 'Bloxberg',
publisherId: 1234,
roles: [],
userLocation: null,
},
},
}),
@ -1605,9 +1613,17 @@ describe('UserResolver', () => {
expect.objectContaining({
data: {
login: {
alias: 'BBB',
firstName: 'Bibi',
gmsAllowed: true,
gmsPublishLocation: 'GMS_LOCATION_TYPE_RANDOM',
gmsPublishName: 'PUBLISH_NAME_ALIAS_OR_INITALS',
gradidoID: expect.any(String),
hasElopage: false,
id: expect.any(Number),
hideAmountGDD: false,
hideAmountGDT: false,
humhubAllowed: true,
humhubPublishName: 'PUBLISH_NAME_ALIAS_OR_INITALS',
klickTipp: {
newsletterState: false,
},
@ -1615,6 +1631,7 @@ describe('UserResolver', () => {
lastName: 'Bloxberg',
publisherId: 1234,
roles: [],
userLocation: null,
},
},
}),
@ -2467,6 +2484,7 @@ describe('UserResolver', () => {
}
beforeAll(async () => {
jest.clearAllMocks()
admin = await userFactory(testEnv, peterLustig)
await mutate({
mutation: login,

View File

@ -343,16 +343,25 @@ export const redeemTransactionLink = gql`
export const login = gql`
mutation ($email: String!, $password: String!, $publisherId: Int) {
login(email: $email, password: $password, publisherId: $publisherId) {
id
gradidoID
alias
firstName
lastName
language
klickTipp {
newsletterState
}
gmsAllowed
humhubAllowed
gmsPublishName
humhubPublishName
gmsPublishLocation
userLocation
hasElopage
publisherId
roles
hideAmountGDD
hideAmountGDT
}
}
`

View File

@ -3,6 +3,8 @@ import { FullConfig } from '@playwright/test';
async function globalSetup(config: FullConfig) {
process.env.EMAIL = 'bibi@bloxberg.de';
process.env.PASSWORD = 'Aa12345_';
process.env.GMS_ACTIVE = false;
process.env.HUMHUB_ACTIVE = false;
}
export default globalSetup;

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

View File

@ -54,8 +54,8 @@ const createVuexStore = (state = {}) =>
},
})
CONFIG.GMS_ACTIVE = 'true'
CONFIG.HUMHUB_ACTIVE = 'true'
CONFIG.GMS_ACTIVE = true
CONFIG.HUMHUB_ACTIVE = true
describe('Sidebar', () => {
let wrapper
@ -89,7 +89,7 @@ describe('Sidebar', () => {
describe('the general section', () => {
it('has seven nav-items', () => {
const generalSection = wrapper.findAll('ul')[0]
expect(generalSection.findAll('.nav-item')).toHaveLength(7)
expect(generalSection.findAll('.nav-item')).toHaveLength(5)
})
it('has nav-item "navigation.overview" in navbar', () => {
@ -111,14 +111,6 @@ describe('Sidebar', () => {
it('has nav-item "navigation.info" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(4).text()).toContain('Info')
})
it('has nav-item "navigation.circles" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(5).text()).toContain('Circles')
})
it('has nav-item "navigation.usersearch" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(6).text()).toContain('User Search')
})
})
describe('the specific section', () => {
@ -128,7 +120,7 @@ describe('Sidebar', () => {
})
it('has two nav-items', () => {
expect(wrapper.findAll('.nav-item').slice(7)).toHaveLength(2)
expect(wrapper.findAll('.nav-item').slice(6)).toHaveLength(1)
})
it('has nav-item "navigation.settings" in navbar', () => {
@ -146,7 +138,7 @@ describe('Sidebar', () => {
})
it('has three nav-items', () => {
expect(wrapper.findAll('.nav-item').slice(7)).toHaveLength(3)
expect(wrapper.findAll('.nav-item').slice(6)).toHaveLength(2)
})
it('has nav-item "navigation.settings" in navbar', () => {
@ -154,9 +146,9 @@ describe('Sidebar', () => {
})
it('has nav-item "navigation.admin_area" in navbar', () => {
const adminItems = wrapper.findAll('.nav-item').slice(7)
expect(adminItems.length).toBeGreaterThan(1)
expect(adminItems[1].text()).toContain('Admin Area')
const adminItems = wrapper.findAll('.nav-item').slice(6)
expect(adminItems.length).toBeGreaterThan(0)
expect(adminItems[0].text()).toContain('Admin Area')
})
it('has nav-item "navigation.logout" in navbar', () => {

View File

@ -38,18 +38,6 @@
<span class="ms-2">{{ $t('navigation.info') }}</span>
</div>
</BNavItem>
<BNavItem v-if="isHumhub" to="/circles" class="mb-3" active-class="active-route">
<div class="sidebar-menu-item-wrapper">
<i-arcticons-circles class="svg-icon" />
<span class="ms-2">{{ $t('navigation.circles') }}</span>
</div>
</BNavItem>
<BNavItem v-if="isGMS" to="/usersearch" active-class="active-route">
<div class="sidebar-menu-item-wrapper">
<i-mdi-map-search class="svg-icon" />
<span class="ms-2">{{ $t('navigation.usersearch') }}</span>
</div>
</BNavItem>
</BNav>
<hr class="m-3" />
<BNav vertical class="w-100">
@ -99,7 +87,6 @@
</div>
</template>
<script setup>
import CONFIG from '../../config'
import { useRoute } from 'vue-router'
import { ref, watch, computed } from 'vue'
@ -118,12 +105,6 @@ const transactionClass = computed(() => {
}
return 'mb-3'
})
const isHumhub = computed(() => {
return CONFIG.HUMHUB_ACTIVE === 'true'
})
const isGMS = computed(() => {
return CONFIG.GMS_ACTIVE === 'true'
})
watch(
() => route.path,

View File

@ -0,0 +1,99 @@
<template>
<div v-if="humhubAllowed" class="mb-3 p-3 card-circles">
<BContainer class="bg-white app-box-shadow gradido-border-radius p-4 mt--3">
<div class="h3">{{ $t('card-circles.headline') }}</div>
<div v-if="humhubAllowed" class="my-3 text-small">
<span
v-for="(line, lineNumber) of $t('card-circles.allowed.text').split('\n')"
:key="lineNumber"
>
{{ line }}
<br />
</span>
</div>
<div v-else class="my-3 text-small">
<span
v-for="(line, lineNumber) of $t('card-circles.not-allowed.text').split('\n')"
:key="lineNumber"
>
{{ line }}
<br />
</span>
</div>
<BRow class="my-1">
<BCol cols="12">
<div class="text-lg-end">
<BButton
v-if="humhubAllowed"
:href="humhubUri"
variant="gradido"
:disabled="enableButton === false"
target="_blank"
>
{{ $t('card-circles.allowed.button') }}
</BButton>
<RouterLink v-else to="/settings/extern">
<BButton variant="gradido">
{{ $t('card-circles.not-allowed.button') }}
</BButton>
</RouterLink>
</div>
</BCol>
</BRow>
</BContainer>
</div>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import { useQuery } from '@vue/apollo-composable'
import { useStore } from 'vuex'
import { authenticateHumhubAutoLogin } from '@/graphql/queries'
const store = useStore()
const enableButton = ref(false)
const humhubUri = ref('')
const humhubAllowed = computed(() => store.state.humhubAllowed)
const {
refetch: refetchAuthenticateHumhub,
onResult,
onError,
} = useQuery(authenticateHumhubAutoLogin, null, {
fetchPolicy: 'network-only',
enabled: true,
})
onResult(({ data }) => {
if (data) {
humhubUri.value = data.authenticateHumhubAutoLogin
enableButton.value = true
}
})
onError(() => {
enableButton.value = true
humhubUri.value = ''
store.commit('humhubAllowed', false)
})
const handleAuthenticateHumhubAutoLogin = async () => {
enableButton.value = false
humhubUri.value = null
await refetchAuthenticateHumhub()
}
onMounted(() => {
handleAuthenticateHumhubAutoLogin()
})
</script>
<style scoped>
.card {
background-attachment: absolute;
background-position: center;
background-repeat: no-repeat;
background-size: 350px 350px;
background-image: url('/img/svg/Gradido_Blaetter_Mainpage.svg') !important;
}
</style>

View File

@ -0,0 +1,104 @@
<template>
<div class="mb-3 p-3 card-user-search">
<BContainer class="bg-white app-box-shadow gradido-border-radius p-4 mt--3 container">
<div class="h3">{{ $t('card-user-search.headline') }}</div>
<div v-if="gmsUserLocationExists" class="my-3 text-small">
<span
v-for="(line, lineNumber) of $t('card-user-search.allowed.text').split('\n')"
:key="lineNumber"
>
{{ line }}
<br />
</span>
</div>
<div v-else class="my-3 text-small">
<span
v-for="(line, lineNumber) of $t('card-user-search.not-allowed.text').split('\n')"
:key="lineNumber"
>
{{ line }}
<br />
</span>
</div>
<BRow class="my-1">
<BCol cols="12">
<div class="text-lg-end">
<div v-if="gmsUserLocationExists">
<BButton
v-if="isUserSearchDisabled"
:disabled="isUserSearchDisabled"
variant="gradido"
:href="gmsUri"
target="_blank"
>
{{ $t('card-user-search.allowed.disabled-button') }}
</BButton>
<BButton v-else variant="gradido" :href="gmsUri" target="_blank">
{{ $t('card-user-search.allowed.button') }}
</BButton>
</div>
<div v-else>
<RouterLink to="/settings/extern">
<BButton variant="gradido">
{{ $t('card-user-search.not-allowed.button') }}
</BButton>
</RouterLink>
</div>
</div>
</BCol>
</BRow>
</BContainer>
</div>
</template>
<script setup>
import { ref, computed } from 'vue'
import { useQuery } from '@vue/apollo-composable'
import { useAppToast } from '@/composables/useToast'
import { authenticateGmsUserSearch } from '@/graphql/queries'
import { useStore } from 'vuex'
const { toastError } = useAppToast()
const store = useStore()
const gmsUri = ref('not initialized')
/*
console.log(
'store.state: gmsAllowed userLocation=',
store.state.gmsAllowed,
store.state.userLocation,
)
*/
const gmsAllowed = store.state.gmsAllowed
// console.log('gmsAllowed=', gmsAllowed)
const gmsUserLocationExists = store.state.userLocation !== null
// console.log('gmsUserLocationExists=', gmsUserLocationExists)
const isUserSearchDisabled = computed(() => gmsUri.value !== null)
const { onResult, result, loading, onError } = useQuery(authenticateGmsUserSearch)
onResult(({ data }) => {
if (gmsAllowed && gmsUserLocationExists && data !== undefined) {
gmsUri.value = `${data.authenticateGmsUserSearch.url}?accesstoken=${data.authenticateGmsUserSearch.token}`
}
})
onError(() => {
if (gmsAllowed && gmsUserLocationExists) {
toastError('authenticateGmsUserSearch failed!')
} else if (gmsAllowed && !gmsUserLocationExists) {
// toastError('capture your location first!')
// eslint-disable-next-line no-console
console.log('capture your location first...')
}
})
</script>
<style scoped>
.container {
background-attachment: absolute;
background-position: left;
background-repeat: no-repeat;
background-size: 380px 100%;
background-image: url('/img/svg/usersearchmap5.jpg') !important;
}
</style>

View File

@ -26,7 +26,7 @@ describe('UserGMSLocationFormat', () => {
let wrapper
const mockStore = {
state: {
gmsPublishLocation: 'GMS_LOCATION_TYPE_RANDOM',
gmsPublishLocation: 'GMS_LOCATION_TYPE_APPROXIMATE',
},
commit: vi.fn(),
}
@ -54,17 +54,16 @@ describe('UserGMSLocationFormat', () => {
it('renders the correct dropdown options', () => {
const dropdownItems = wrapper.findAll('.dropdown-item')
expect(dropdownItems.length).toBe(3)
expect(dropdownItems.length).toBe(2)
const labels = dropdownItems.map((item) => item.text())
expect(labels).toEqual([
'settings.GMS.publish-location.exact',
'settings.GMS.publish-location.approximate',
'settings.GMS.publish-location.random',
])
})
it('updates selected option on click', async () => {
it.skip('updates selected option on click', async () => {
mockMutate.mockResolvedValue({})
const dropdownItem = wrapper.findAll('.dropdown-item').at(1) // Click the second item
@ -84,7 +83,7 @@ describe('UserGMSLocationFormat', () => {
})
it('does not update when clicking on already selected option', async () => {
const dropdownItem = wrapper.findAll('.dropdown-item').at(2) // Click the third item (which is already selected)
const dropdownItem = wrapper.findAll('.dropdown-item').at(1) // Click the second item (which is already selected)
await dropdownItem.trigger('click')
expect(mockMutate).not.toHaveBeenCalled()
@ -94,7 +93,7 @@ describe('UserGMSLocationFormat', () => {
it('handles error when updating', async () => {
mockMutate.mockRejectedValue(new Error('Ouch'))
const dropdownItem = wrapper.findAll('.dropdown-item').at(1) // Click the second item
const dropdownItem = wrapper.findAll('.dropdown-item').at(0) // Click the first item
await dropdownItem.trigger('click')
expect(mockToastError).toHaveBeenCalledWith('Ouch')

View File

@ -25,7 +25,11 @@ const { t } = useI18n()
const store = useStore()
const { toastError, toastSuccess } = useAppToast()
const selectedOption = ref(store.state.gmsPublishLocation ?? 'GMS_LOCATION_TYPE_RANDOM')
const selectedOption = ref(
store.state.gmsPublishLocation === 'GMS_LOCATION_TYPE_RANDOM'
? 'GMS_LOCATION_TYPE_APPROXIMATE'
: store.state.gmsPublishLocation,
)
const dropdownOptions = [
{
label: t('settings.GMS.publish-location.exact'),
@ -35,10 +39,12 @@ const dropdownOptions = [
label: t('settings.GMS.publish-location.approximate'),
value: 'GMS_LOCATION_TYPE_APPROXIMATE',
},
/*
{
label: t('settings.GMS.publish-location.random'),
value: 'GMS_LOCATION_TYPE_RANDOM',
},
*/
]
const selectedOptionLabel = computed(() => {

View File

@ -38,8 +38,8 @@ if (process.env.FRONTEND_HOSTING === 'nodejs') {
// version.FRONTEND_MODULE_PORT
const features = {
GMS_ACTIVE: process.env.GMS_ACTIVE ?? false,
HUMHUB_ACTIVE: process.env.HUMHUB_ACTIVE ?? false,
GMS_ACTIVE: process.env.GMS_ACTIVE === 'true',
HUMHUB_ACTIVE: process.env.HUMHUB_ACTIVE === 'true',
}
const environment = {

View File

@ -183,6 +183,7 @@ export const login = gql`
gmsPublishName
humhubPublishName
gmsPublishLocation
userLocation
hasElopage
publisherId
roles

View File

@ -30,10 +30,33 @@
}
},
"back": "Zurück",
"circles": {
"card-circles": {
"headline": "Gemeinsam unterstützen wir einander achtsam in Kreiskultur.",
"text": "Mit Klick auf den Button öffnest Du die Kooperationsplattform in einem neuen Browser-Fenster.",
"button": "Kreise starten..."
"allowed": {
"button": "Kreise starten...",
"text": "Mit Klick auf den Button öffnest Du die Kooperationsplattform in einem neuen Browser-Fenster."
},
"not-allowed": {
"button": "Konfiguration starten...",
"text": "Du hast Kreise noch nicht konfiguriert! Öffne zuerst die Kreise-Konfiguration."
}
},
"card-user-search": {
"headline": "Geografische Nutzersuche (experimentell)",
"allowed": {
"button": "Öffne Nutzersuche...",
"disabled-button": "GMS offline...",
"text": "Finde Mitglieder aller Communities auf einer Landkarte."
},
"not-allowed": {
"button": "Standort festlegen...",
"text": "Finde Mitglieder aller Communities auf einer Landkarte? Dann musst du selbst erst deinen Standort festlegen."
}
},
"circles": {
"button": "Kreise starten...",
"headline": "Gemeinsam unterstützen wir einander achtsam in Kreiskultur.",
"text": "Mit Klick auf den Button öffnest Du die Kooperationsplattform in einem neuen Browser-Fenster."
},
"community": {
"admins": "Administratoren",
@ -287,10 +310,8 @@
"overview": "Übersicht",
"send": "Senden",
"settings": "Einstellungen",
"circles": "Kreise",
"support": "Support",
"transactions": "Transaktionen",
"usersearch": "Nutzersuche"
"transactions": "Transaktionen"
},
"openHours": "Offene Stunden",
"pageTitle": {
@ -314,15 +335,14 @@
"warningText": "Bist du noch da?"
},
"settings": {
"allow-community-services": "Community-Dienste erlauben",
"community": "Community",
"community": "Kreise & Mitgliedsuche",
"emailInfo": "Kann aktuell noch nicht geändert werden.",
"GMS": {
"disabled": "Daten werden nicht nach GMS exportiert",
"enabled": "Daten werden nach GMS exportiert",
"location": {
"button": "Klick mich!",
"label": "Positionsbestimmung",
"button": "Karte öffnen",
"label": "Dein Standort",
"saveLocation": "Standort speichern",
"updateSuccess": "Standort erfolgreich gespeichert"
},
@ -339,7 +359,6 @@
"publish-location": {
"exact": "Genaue Position",
"approximate": "Ungefähre Position",
"random": "Zufallsposition",
"updated": "Positionstyp für GMS aktualisiert"
},
"publish-name": {

View File

@ -30,10 +30,33 @@
}
},
"back": "Back",
"circles": {
"card-circles": {
"headline": "Together we support each other - mindful in circle culture.",
"text": "Click on the button to open the cooperation platform in a new browser window.",
"button": "Start Circles..."
"allowed": {
"button": "Start Circles...",
"text": "Click on the button to open the cooperation platform in a new browser window."
},
"not-allowed": {
"button": "Start Circles-Configuration...",
"text": "Your Circles are not configured yet! Please open the Circles-Configuration first."
}
},
"card-user-search": {
"headline": "Geografice Usersearch (experimentel)",
"allowed": {
"button": "Start Usersearch...",
"disabled-button": "GMS offline...",
"text": "Find Members of all Communities on a Map."
},
"not-allowed": {
"button": "Start Location-Capturing...",
"text": "Find Members of all Communities on a Map? Then you have to capture your Location first."
}
},
"circles": {
"button": "Start Circles...",
"headline": "Together we support each other - mindful in circle culture.",
"text": "Click on the button to open the cooperation platform in a new browser window."
},
"community": {
"admins": "Administrators",
@ -287,10 +310,8 @@
"overview": "Overview",
"send": "Send",
"settings": "Settings",
"circles": "Circles",
"support": "Support",
"transactions": "Transactions",
"usersearch": "Geographical User Search"
"transactions": "Transactions"
},
"openHours": "Open Hours",
"pageTitle": {
@ -314,14 +335,13 @@
"warningText": "Are you still there?"
},
"settings": {
"allow-community-services": "Allow Community Services",
"community": "Community",
"emailInfo": "Cannot be changed at this time.",
"GMS": {
"disabled": "Data not exported to GMS",
"enabled": "Data exported to GMS",
"location": {
"button": "Click me!",
"button": "Open Map",
"label": "Pinpoint location",
"saveLocation": "Save Location",
"updateSuccess": "Location successfully saved"
@ -339,7 +359,6 @@
"publish-location": {
"exact": "exact position",
"approximate": "approximate position",
"random": "random position",
"updated": "format of location for GMS updated"
},
"publish-name": {

View File

@ -249,10 +249,8 @@
"overview": "Resumen",
"profile": "Mi Perfil",
"send": "Enviar",
"circles": "Círculos",
"support": "Soporte",
"transactions": "Transacciones",
"usersearch": "Buscar usuarios"
"transactions": "Transacciones"
},
"openHours": "Open Hours",
"pageTitle": {

View File

@ -257,10 +257,8 @@
"overview": "Aperçu",
"send": "Envoyer",
"settings": "Configuration",
"circles": "Cercles",
"support": "Aide",
"transactions": "Transactions",
"usersearch": "Recherche d'utilisateurs"
"transactions": "Transactions"
},
"openHours": "Heures ouverte",
"pageTitle": {

View File

@ -249,10 +249,8 @@
"overview": "Overzicht",
"profile": "Mijn profiel",
"send": "Sturen",
"circles": "Cirkels",
"support": "Support",
"transactions": "Transacties",
"usersearch": "Gebruiker zoeken"
"transactions": "Transacties"
},
"openHours": "Open Hours",
"pageTitle": {

View File

@ -72,6 +72,7 @@ import { useMutation, useLazyQuery } from '@vue/apollo-composable'
import { useAppToast } from '@/composables/useToast'
import { useAuthLinks } from '@/composables/useAuthLinks'
import CONFIG from '@/config'
// import { useLoading } from 'vue-loading-overlay'
const router = useRouter()

View File

@ -11,6 +11,23 @@ vi.mock('@/components/Overview/CommunityNews', () => ({
},
}))
vi.mock('@vue/apollo-composable', () => ({
useQuery: vi.fn().mockReturnValue({
onResult: vi.fn(),
onError: vi.fn(),
loading: { value: false },
error: { value: null },
refetch: vi.fn(),
}),
}))
vi.mock('@/components/Overview/CardCircles', () => ({
default: {
name: 'CardCircles',
template: '<div class="card-circles"></div>',
},
}))
describe('Overview', () => {
let wrapper
let router
@ -43,7 +60,7 @@ describe('Overview', () => {
})
describe('mount', () => {
it('has a community news element', () => {
it.skip('has a community news element', () => {
expect(wrapper.find('div.community-news').exists()).toBe(true)
})
})

View File

@ -1,15 +1,38 @@
<template>
<div class="overview">
<community-news />
<BCol>
<div v-if="isHumhubActive">
<BRow>
<card-circles />
</BRow>
</div>
<div v-if="isGmsActive">
<BRow>
<card-user-search />
</BRow>
</div>
</BCol>
</div>
</template>
<script>
import CommunityNews from '@/components/Overview/CommunityNews'
// import CommunityNews from '@/components/Overview/CommunityNews'
import CardCircles from '@/components/Overview/CardCircles'
import CardUserSearch from '@/components/Overview/CardUserSearch'
import CONFIG from '@/config'
export default {
name: 'Overview',
components: {
CommunityNews,
CardCircles,
CardUserSearch,
},
computed: {
isGmsActive() {
return CONFIG.GMS_ACTIVE === true
},
isHumhubActive() {
return CONFIG.HUMHUB_ACTIVE === true
},
},
}
</script>

View File

@ -86,7 +86,6 @@
class="community-service-tabs"
:title="$t('settings.community')"
>
<div class="h2">{{ $t('settings.allow-community-services') }}</div>
<div v-if="isHumhub" class="mt-3">
<BRow>
<BCol cols="12" md="6" lg="6">
@ -123,7 +122,7 @@
<BCol cols="12" md="6" lg="6">
<div class="h3">{{ $t('GMS.title') }}</div>
</BCol>
<BCol cols="12" md="6" lg="6" class="text-end">
<BCol cols="12" md="6" lg="6" class="text-start">
<user-settings-switch
:initial-value="state.gmsAllowed"
:attr-name="'gmsAllowed'"
@ -239,17 +238,10 @@ const isHumhubActivated = computed(() => {
return humhubAllowed.value === true
})
const isGMS = computed(() => {
return CONFIG.GMS_ACTIVE === 'true'
})
const isHumhub = computed(() => {
return CONFIG.HUMHUB_ACTIVE === 'true'
})
const isCommunityService = computed(() => {
return isGMS.value || isHumhub.value
})
// setting if gms and/or humhub are enabled in frontend config .env
const isGMS = CONFIG.GMS_ACTIVE
const isHumhub = CONFIG.HUMHUB_ACTIVE
const isCommunityService = isGMS || isHumhub
const { mutate: updateUserData } = useMutation(updateUserInfos)

View File

@ -75,6 +75,9 @@ export const mutations = {
setDarkMode: (state, darkMode) => {
state.darkMode = !!darkMode
},
userLocation: (state, userLocation) => {
state.userLocation = userLocation
},
redirectPath: (state, redirectPath) => {
state.redirectPath = redirectPath || '/overview'
},
@ -102,6 +105,7 @@ export const actions = {
commit('hideAmountGDD', data.hideAmountGDD)
commit('hideAmountGDT', data.hideAmountGDT)
commit('setDarkMode', data.darkMode)
commit('userLocation', data.userLocation)
},
logout: ({ commit, state }) => {
commit('token', null)
@ -123,6 +127,7 @@ export const actions = {
commit('hideAmountGDT', true)
commit('email', '')
commit('setDarkMode', false)
commit('userLocation', null)
commit('redirectPath', '/overview')
localStorage.clear()
},
@ -163,6 +168,7 @@ try {
hideAmountGDT: null,
email: '',
darkMode: false,
userLocation: null,
redirectPath: '/overview',
transactionToHighlightId: '',
},

View File

@ -146,7 +146,7 @@ describe('Vuex store', () => {
it('calls seventeen commits', () => {
login({ commit, state }, commitedData)
expect(commit).toHaveBeenCalledTimes(17)
expect(commit).toHaveBeenCalledTimes(18)
})
// ... (other login action tests remain largely the same)
@ -161,9 +161,9 @@ describe('Vuex store', () => {
const commit = vi.fn()
const state = {}
it('calls twenty commits', () => {
it('calls twenty-one commits', () => {
logout({ commit, state })
expect(commit).toHaveBeenCalledTimes(20)
expect(commit).toHaveBeenCalledTimes(21)
})
// ... (other logout action tests remain largely the same)

View File

@ -93,8 +93,8 @@ export default defineConfig(async ({ command }) => {
autoInstall: true,
}),
EnvironmentPlugin({
GMS_ACTIVE: null,
HUMHUB_ACTIVE: null,
GMS_ACTIVE: CONFIG.GMS_ACTIVE,
HUMHUB_ACTIVE: CONFIG.HUMHUB_ACTIVE,
DEFAULT_PUBLISHER_ID: null,
PORT: null,
COMMUNITY_HOST: null,