Merge pull request #3468 from gradido/gms_improvements

feat(frontend): gms improvements
This commit is contained in:
einhornimmond 2025-04-22 16:40:01 +02:00 committed by GitHub
commit 41af4c6f4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 180 additions and 145 deletions

View File

@ -71,7 +71,8 @@ const defaultData = {
const defaultUser = {
firstName: 'Peter',
lastName: 'Lustig',
humhubUsername: 'peter.lustig',
uniqueUsername: 'peter.lustig',
publicName: 'PeLu',
createdAt: new Date().toString(),
emailContact: {
email: 'peter.lustig@example.com',

View File

@ -12,7 +12,7 @@
{{ $t('filter.byEmail') }}
</BTooltip>
&nbsp;
{{ contribution.user.humhubUsername }}
{{ contribution.user.publicName }}
&nbsp;
<span>
<a
@ -103,7 +103,7 @@ const humhubProfileLink = computed(() => {
if (url.endsWith('/')) {
url = url.slice(0, -1)
}
return `${url}/u/${props.contribution.humhubUsername}`
return `${url}/u/${props.contribution.user.userIdentifier}`
})
const messages = ref([])

View File

@ -13,7 +13,8 @@ query adminListContributions(
email
}
...UserCommonFields
humhubUsername
publicName
userIdentifier
createdAt
}
amount

View File

@ -135,6 +135,7 @@ const noHashtag = ref(null)
const hideResubmissionModel = ref(true)
const formatDateOrDash = (value) => (value ? new Date(value).toLocaleDateString() : '—')
const baseFields = {
firstName: { key: 'user.firstName', label: t('firstname'), class: 'no-select' },
lastName: { key: 'user.lastName', label: t('lastname'), class: 'no-select' },
@ -181,6 +182,7 @@ const fields = computed(
[
baseFields.firstName,
baseFields.lastName,
baseFields.amount,
baseFields.memo,
baseFields.contributionDate,
baseFields.createdAt,

View File

@ -40,6 +40,10 @@ export default defineConfig(async ({ command }) => {
host: CONFIG.ADMIN_MODULE_HOST, // '0.0.0.0',
port: CONFIG.ADMIN_MODULE_PORT, // 8080,
},
preview: {
host: CONFIG.ADMIN_MODULE_HOST, // '0.0.0.0',
port: CONFIG.ADMIN_MODULE_PORT, // 8080,
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),

View File

@ -7,7 +7,7 @@ module.exports = {
collectCoverageFrom: ['src/**/*.ts', '!**/node_modules/**', '!src/seeds/**', '!build/**'],
coverageThreshold: {
global: {
lines: 78,
lines: 77,
},
},
setupFiles: ['<rootDir>/test/testSetup.ts'],

View File

@ -16,8 +16,7 @@
"test": "cross-env TZ=UTC NODE_ENV=development jest --runInBand --forceExit --detectOpenHandles",
"seed": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/seeds/index.ts",
"klicktipp": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/util/executeKlicktipp.ts",
"gmsusers": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/seeds/gmsUsers.ts",
"gmsuserList": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/seeds/gmsUserList.ts",
"gmsusers": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/apis/gms/ExportUsers.ts",
"humhubUserExport": "cross-env TZ=UTC NODE_ENV=development ts-node -r tsconfig-paths/register src/apis/humhub/ExportUsers.ts",
"locales": "scripts/sort.sh"
},

View File

@ -4,7 +4,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { entities } from '@entity/index'
import { User as DbUser } from '@entity/User'
// import { createTestClient } from 'apollo-server-testing'
@ -18,6 +17,8 @@ import { LogError } from '@/server/LogError'
import { backendLogger as logger } from '@/server/logger'
CONFIG.EMAIL = false
// use force to copy over all user even if gmsRegistered is set to true
const forceMode = process.argv.includes('--force')
const context = {
token: '',
@ -31,21 +32,6 @@ const context = {
clientTimezoneOffset: 0,
}
export const cleanDB = async () => {
// this only works as long we do not have foreign key constraints
for (const entity of entities) {
await resetEntity(entity)
}
}
const resetEntity = async (entity: any) => {
const items = await entity.find({ withDeleted: true })
if (items.length > 0) {
const ids = items.map((e: any) => e.id)
await entity.delete(ids)
}
}
const run = async () => {
const server = await createServer(context)
// const seedClient = createTestClient(server.apollo)
@ -59,11 +45,11 @@ const run = async () => {
const userIds = await DbUser.createQueryBuilder()
.select('id')
.where({ foreign: false })
// .andWhere('deleted_at is null')
// .andWhere({ gmsRegistered: false })
.andWhere('deleted_at is null')
.getRawMany()
logger.debug('userIds:', userIds)
let alreadyUpdatedUserCount = 0
for (const idStr of userIds) {
logger.debug('Id:', idStr.id)
const user = await DbUser.findOne({
@ -73,7 +59,7 @@ const run = async () => {
if (user) {
logger.debug('found local User:', user)
if (user.gmsAllowed) {
await sendUserToGms(user, homeCom)
await sendUserToGms(user, homeCom, forceMode)
/*
const gmsUser = new GmsUser(user)
try {
@ -93,6 +79,8 @@ const run = async () => {
logger.debug('GMS-Publishing not allowed by user settings:', user)
}
}
alreadyUpdatedUserCount++
process.stdout.write(`updated user: ${alreadyUpdatedUserCount}/${userIds.length}\r`)
}
logger.info('##gms## publishing all local users successful...')

View File

@ -2,6 +2,7 @@ import { User as dbUser } from '@entity/User'
import { PublishNameLogic } from '@/data/PublishName.logic'
// import { GmsPublishLocationType } from '@/graphql/enum/GmsPublishLocationType'
import { GmsPublishLocationType } from '@/graphql/enum/GmsPublishLocationType'
import { GmsPublishPhoneType } from '@/graphql/enum/GmsPublishPhoneType'
import { PublishNameType } from '@/graphql/enum/PublishNameType'
@ -15,13 +16,19 @@ export class GmsUser {
this.email = this.getGmsEmail(user)
this.countryCode = this.getGmsCountryCode(user)
this.mobile = this.getGmsPhone(user)
const fn = pnLogic.getFirstName(user.gmsPublishName)
const fn = pnLogic.getFirstName(user.gmsPublishName as PublishNameType)
this.firstName = fn !== '' ? fn : null // getGmsFirstName(user)
const ln = pnLogic.getLastName(user.gmsPublishName)
const ln = pnLogic.getLastName(user.gmsPublishName as PublishNameType)
this.lastName = ln !== '' ? ln : null // getGmsLastName(user)
this.alias = this.getGmsAlias(user)
this.alias = pnLogic.getPublicName(user.gmsPublishName as PublishNameType)
this.type = user.gmsPublishLocation // GmsPublishLocationType.GMS_LOCATION_TYPE_RANDOM
this.location = user.location
if ((this.type as GmsPublishLocationType) === GmsPublishLocationType.GMS_LOCATION_TYPE_RANDOM) {
this.type = GmsPublishLocationType.GMS_LOCATION_TYPE_APPROXIMATE
}
if (!this.location) {
this.type = GmsPublishLocationType.GMS_LOCATION_TYPE_RANDOM
}
}
id: number

View File

@ -1,8 +1,5 @@
import { User } from '@entity/User'
import { PublishNameLogic } from '@/data/PublishName.logic'
import { PublishNameType } from '@/graphql/enum/PublishNameType'
import { Account } from './Account'
import { Profile } from './Profile'
@ -10,12 +7,6 @@ export abstract class AbstractUser {
public constructor(user: User) {
this.account = new Account(user)
this.profile = new Profile(user)
// temp fix for prevent double usernames in humhub, if the username ist created from initials
const publishNameLogic = new PublishNameLogic(user)
if (publishNameLogic.isUsernameFromInitials(user.humhubPublishName as PublishNameType)) {
this.profile.firstname = this.account.username
this.account.username = user.gradidoID
}
}
account: Account

View File

@ -8,7 +8,7 @@ import { PublishNameType } from '@/graphql/enum/PublishNameType'
export class Account {
public constructor(user: User) {
const publishNameLogic = new PublishNameLogic(user)
this.username = publishNameLogic.getUsername(user.humhubPublishName as PublishNameType)
this.username = publishNameLogic.getUserIdentifier(user.humhubPublishName as PublishNameType)
this.email = user.emailContact.email
this.language = convertGradidoLanguageToHumhub(user.language)
this.status = 1

View File

@ -138,6 +138,7 @@ const gms = {
// koordinates of Illuminz-instance of GMS
GMS_API_URL: process.env.GMS_API_URL ?? 'http://localhost:4044/',
GMS_DASHBOARD_URL: process.env.GMS_DASHBOARD_URL ?? 'http://localhost:8080/',
GMS_USER_SEARCH_FRONTEND_ROUTE: process.env.GMS_USER_SEARCH_FRONTEND_ROUTE ?? 'user-search',
// used as secret postfix attached at the gms community-auth-url endpoint ('/hook/gms/' + 'secret')
GMS_WEBHOOK_SECRET: process.env.GMS_WEBHOOK_SECRET ?? 'secret',
}

View File

@ -279,6 +279,14 @@ export const schema = Joi.object({
.default('http://localhost:8080/')
.description('The URL for the GMS dashboard'),
GMS_USER_SEARCH_FRONTEND_ROUTE: Joi.string()
.pattern(/^[\w_-]*$/)
.allow('')
.default('user-search')
.description(
'gms frontend playground route, user-search for standalone playground, usersearch-playground for old, empty for testing local',
),
GMS_WEBHOOK_SECRET: Joi.string()
.min(1)
.default('secret')

View File

@ -1,23 +1,87 @@
import { User } from '@entity/User'
import { v4 as uuidv4 } from 'uuid'
import { PublishNameType } from '@/graphql/enum/PublishNameType'
import { PublishNameLogic } from './PublishName.logic'
const gradidoUuid = uuidv4()
let user: User
let logic: PublishNameLogic
/*
export enum PublishNameType {
PUBLISH_NAME_ALIAS_OR_INITALS = 0,
PUBLISH_NAME_INITIALS = 1,
PUBLISH_NAME_FIRST = 2,
PUBLISH_NAME_FIRST_INITIAL = 3,
PUBLISH_NAME_FULL = 4,
}
*/
describe('test publish name logic', () => {
describe('test username', () => {
it('alias or initials with alias set', () => {
const user = new User()
user.alias = 'alias'
const logic = new PublishNameLogic(user)
expect(logic.getUsername(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe(user.alias)
beforeEach(() => {
user = new User()
user.alias = 'alias'
user.firstName = 'John'
user.lastName = 'Smith'
user.gradidoID = gradidoUuid
logic = new PublishNameLogic(user)
})
describe('test user identifier ', () => {
it('for alias or initials with alias set', () => {
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe('alias')
})
it('alias or initials with empty alias', () => {
const user = new User()
user.firstName = 'John'
user.lastName = 'Smith'
const logic = new PublishNameLogic(user)
expect(logic.getUsername(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe('JoSm')
it('for alias or initials with empty alias', () => {
user.alias = ''
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe(
gradidoUuid,
)
})
it('for publish name initials', () => {
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_INITIALS)).toBe(gradidoUuid)
})
it('for publish name first', () => {
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_FIRST)).toBe(gradidoUuid)
})
it('for publish name first initial', () => {
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_FIRST_INITIAL)).toBe(gradidoUuid)
})
it('for publish name full', () => {
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_FULL)).toBe(gradidoUuid)
})
})
describe('test public name', () => {
it('for alias or initials with alias set', () => {
expect(logic.getPublicName(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe('alias')
})
it('for alias or initials with empty alias', () => {
user.alias = ''
expect(logic.getPublicName(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe('JoSm')
})
it('for alias or initials with empty alias and lower case written names', () => {
user.alias = ''
user.firstName = 'john'
user.lastName = 'smith'
expect(logic.getPublicName(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe('JoSm')
})
it('for publish name initials', () => {
expect(logic.getPublicName(PublishNameType.PUBLISH_NAME_INITIALS)).toBe('JoSm')
})
it('for publish name initials with lower case written names', () => {
user.firstName = 'john'
user.lastName = 'smith'
expect(logic.getPublicName(PublishNameType.PUBLISH_NAME_INITIALS)).toBe('JoSm')
})
it('for publish name first', () => {
expect(logic.getPublicName(PublishNameType.PUBLISH_NAME_FIRST)).toBe('John')
})
it('for publish name first initial', () => {
expect(logic.getPublicName(PublishNameType.PUBLISH_NAME_FIRST_INITIAL)).toBe('John S')
})
it('for publish name full', () => {
expect(logic.getPublicName(PublishNameType.PUBLISH_NAME_FULL)).toBe('John Smith')
})
})
})

View File

@ -59,23 +59,34 @@ export class PublishNameLogic {
}
/**
* get username from user.alias for PUBLISH_NAME_ALIAS_OR_INITALS and if user has alias
* get first name first two characters and last name first two characters for PUBLISH_NAME_ALIAS_OR_INITALS
* if no alias or PUBLISH_NAME_INITIALS
* get unique username
* @param publishNameType
* @returns user.alias for publishNameType = PUBLISH_NAME_ALIAS_OR_INITALS and user has alias
* else return user.firstName[0,2] + user.lastName[0,2] for publishNameType = [PUBLISH_NAME_ALIAS_OR_INITALS, PUBLISH_NAME_INITIALS]
* @return when alias if exist and publishNameType = [PUBLISH_NAME_ALIAS_OR_INITALS, PUBLISH_NAME_INITIALS]
* return alias
* else return gradido id
*/
public getUsername(publishNameType: PublishNameType): string {
if (this.isUsernameFromInitials(publishNameType)) {
return (
this.firstUpperCaseSecondLowerCase(this.filterOutInvalidChar(this.user.firstName)) +
this.firstUpperCaseSecondLowerCase(this.filterOutInvalidChar(this.user.lastName))
)
} else if (this.isUsernameFromAlias(publishNameType)) {
return this.filterOutInvalidChar(this.user.alias)
}
return this.user.gradidoID
public getUserIdentifier(publishNameType: PublishNameType): string {
return this.isUsernameFromAlias(publishNameType)
? this.filterOutInvalidChar(this.user.alias)
: this.user.gradidoID
}
/**
* get public name based on publishNameType: PublishNameType value
* @param publishNameType: PublishNameType
* @return alias if exist and type = PUBLISH_NAME_ALIAS_OR_INITALS
* initials if type = PUBLISH_NAME_INITIALS
* full first name if type = PUBLISH_NAME_FIRST
* full first name and last name initial if type = PUBLISH_NAME_FIRST_INITIAL
* full first name and full last name if type = PUBLISH_NAME_FULL
*/
public getPublicName(publishNameType: PublishNameType): string {
return this.isUsernameFromAlias(publishNameType)
? this.filterOutInvalidChar(this.user.alias)
: this.isUsernameFromInitials(publishNameType)
? this.firstUpperCaseSecondLowerCase(this.user.firstName) +
this.firstUpperCaseSecondLowerCase(this.user.lastName)
: (this.getFirstName(publishNameType) + ' ' + this.getLastName(publishNameType)).trim()
}
public isUsernameFromInitials(publishNameType: PublishNameType): boolean {

View File

@ -26,7 +26,9 @@ export class User {
this.alias = user.alias
const publishNameLogic = new PublishNameLogic(user)
this.humhubUsername = publishNameLogic.getUsername(user.humhubPublishName as PublishNameType)
const publishNameType = user.humhubPublishName as PublishNameType
this.publicName = publishNameLogic.getPublicName(publishNameType)
this.userIdentifier = publishNameLogic.getUserIdentifier(publishNameType)
if (user.emailContact) {
this.emailChecked = user.emailContact.emailChecked
@ -71,7 +73,10 @@ export class User {
alias: string | null
@Field(() => String, { nullable: true })
humhubUsername: string | null
publicName: string | null
@Field(() => String, { nullable: true })
userIdentifier: string | null
@Field(() => String, { nullable: true })
firstName: string | null

View File

@ -8,6 +8,7 @@ import { ProjectBranding } from '@entity/ProjectBranding'
import { TransactionLink as DbTransactionLink } from '@entity/TransactionLink'
import { User as DbUser } from '@entity/User'
import { UserContact as DbUserContact } from '@entity/UserContact'
import { UserLoggingView } from '@logging/UserLogging.view'
import { GraphQLResolveInfo } from 'graphql'
import i18n from 'i18n'
import {
@ -738,7 +739,7 @@ export class UserResolver {
})
await queryRunner.commitTransaction()
logger.debug('writing User data successful...', user)
logger.debug('writing User data successful...', new UserLoggingView(user))
} catch (e) {
await queryRunner.rollbackTransaction()
throw new LogError('Error on writing updated user data', e)
@ -832,7 +833,7 @@ export class UserResolver {
throw new LogError('cannot create humhub client')
}
const userNameLogic = new PublishNameLogic(dbUser)
const username = userNameLogic.getUsername(dbUser.humhubPublishName as PublishNameType)
const username = userNameLogic.getUserIdentifier(dbUser.humhubPublishName as PublishNameType)
let humhubUser = await humhubClient.userByUsername(username)
if (!humhubUser) {
humhubUser = await humhubClient.userByEmail(dbUser.emailContact.email)

View File

@ -14,7 +14,7 @@ export async function authenticateGmsUserPlayground(
const result = new GmsUserAuthenticationResult()
const dashboardUrl = ensureUrlEndsWithSlash(CONFIG.GMS_DASHBOARD_URL)
result.url = dashboardUrl.concat('usersearch-playground')
result.url = dashboardUrl.concat(CONFIG.GMS_USER_SEARCH_FRONTEND_ROUTE)
result.token = await verifyAuthToken(dbUser.communityUuid, token)
logger.info('GmsUserAuthenticationResult:', result)
return result

View File

@ -1,5 +1,6 @@
import { Point } from '@dbTools/typeorm'
import { User as DbUser } from '@entity/User'
import { UserLoggingView } from '@logging/UserLogging.view'
import { UpdateUserInfosArgs } from '@/graphql/arg/UpdateUserInfosArgs'
import { GmsPublishLocationType } from '@/graphql/enum/GmsPublishLocationType'
@ -16,7 +17,7 @@ export function compareGmsRelevantUserSettings(
if (!orgUser) {
throw new LogError('comparison without any user is impossible')
}
logger.debug('compareGmsRelevantUserSettings:', orgUser, updateUserInfosArgs)
logger.debug('compareGmsRelevantUserSettings:', new UserLoggingView(orgUser), updateUserInfosArgs)
// nach GMS updaten, wenn alias gesetzt wird oder ist und PublishLevel die alias-Übermittlung erlaubt
if (
updateUserInfosArgs.alias &&
@ -44,7 +45,7 @@ export function compareGmsRelevantUserSettings(
return true
}
if (
updateUserInfosArgs.gmsPublishLocation &&
updateUserInfosArgs.gmsPublishLocation !== undefined &&
(orgUser.gmsPublishLocation as GmsPublishLocationType) !==
updateUserInfosArgs.gmsPublishLocation
) {

View File

@ -7,14 +7,18 @@ import { CONFIG } from '@/config'
import { LogError } from '@/server/LogError'
import { backendLogger as logger } from '@/server/logger'
export async function sendUserToGms(user: DbUser, homeCom: DbCommunity): Promise<void> {
export async function sendUserToGms(
user: DbUser,
homeCom: DbCommunity,
alwaysCreateUser?: boolean,
): Promise<void> {
if (homeCom.gmsApiKey === null) {
throw new LogError('HomeCommunity needs GMS-ApiKey to publish user data to GMS.')
}
logger.debug('User send to GMS:', user)
const gmsUser = new GmsUser(user)
try {
if (!user.gmsRegistered && user.gmsRegisteredAt === null) {
if (alwaysCreateUser === true || (!user.gmsRegistered && user.gmsRegisteredAt === null)) {
logger.debug('create user in gms:', gmsUser)
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
if (await createGmsUser(homeCom.gmsApiKey, gmsUser)) {

View File

@ -1,60 +0,0 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { entities } from '@entity/index'
// import { createTestClient } from 'apollo-server-testing'
import { CONFIG } from '@/config'
import { createServer } from '@/server/createServer'
import { backendLogger as logger } from '@/server/logger'
CONFIG.EMAIL = false
const context = {
token: '',
setHeaders: {
push: (value: { key: string; value: string }): void => {
context.token = value.value
},
// eslint-disable-next-line @typescript-eslint/no-empty-function
forEach: (): void => {},
},
clientTimezoneOffset: 0,
}
export const cleanDB = async () => {
// this only works as long we do not have foreign key constraints
for (const entity of entities) {
await resetEntity(entity)
}
}
const resetEntity = async (entity: any) => {
const items = await entity.find({ withDeleted: true })
if (items.length > 0) {
const ids = items.map((e: any) => e.id)
await entity.delete(ids)
}
}
const run = async () => {
const server = await createServer(context)
// const seedClient = createTestClient(server.apollo)
const { con } = server
// test GMS-Api Client
try {
// const gmsComArray = await communityList()
// logger.debug('GMS-Community-List:', gmsComArray)
// const gmsUserArray = await userList()
// logger.debug('GMS-Community-User-List:', gmsUserArray)
} catch (err) {
logger.error('Error in GMS-API:', err)
}
await con.close()
}
void run()

View File

@ -32,7 +32,7 @@ export class UserLoggingView extends AbstractLoggingView {
lastName: this.self.lastName?.substring(0, 3) + '...',
createdAt: this.dateToString(this.self.createdAt),
deletedAt: this.dateToString(this.self.deletedAt),
passwordEncryptionType: this.self.passwordEncryptionType as PasswordEncryptionType,
passwordEncryptionType: PasswordEncryptionType[this.self.passwordEncryptionType],
language: this.self.language,
hideAmountGDD: this.self.hideAmountGDD,
hideAmountGDT: this.self.hideAmountGDT,

View File

@ -7,7 +7,6 @@
"dev": "concurrently \"yarn watch-scss\" \"vite\"",
"prebuild": "yarn compile-scss",
"build": "vite build",
"preserve": "yarn compile-scss",
"serve": "vite preview",
"postbuild": "find build -type f -regex '.*\\.\\(html\\|js\\|css\\|svg\\|json\\)' -exec gzip -9 -k {} +",
"analyse-bundle": "yarn build && webpack-bundle-analyzer build/webpack.stats.json",

View File

@ -20,6 +20,9 @@
<br />
</span>
</div>
<a href="https://gradido.net/gms1/" target="_blank">
{{ $t('info') }}
</a>
<BRow class="my-1">
<BCol cols="12">
<div class="text-lg-end">

View File

@ -33,8 +33,10 @@ import UserLocationMap from '@/components/UserSettings/UserLocationMap'
import { BButton, BModal } from 'bootstrap-vue-next'
import { userLocationQuery } from '@/graphql/queries'
import CONFIG from '@/config'
import { useStore } from 'vuex'
const { t } = useI18n()
const store = useStore()
const { mutate: updateUserInfo } = useMutation(updateUserInfos)
const { onResult, onError } = useQuery(userLocationQuery, {}, { fetchPolicy: 'network-only' })
const { toastSuccess, toastError } = useAppToast()
@ -73,14 +75,11 @@ const saveUserLocation = async () => {
try {
const loc = { longitude: capturedLocation.value.lng, latitude: capturedLocation.value.lat }
await updateUserInfo({
gmsLocation: {
longitude: capturedLocation.value.lng,
latitude: capturedLocation.value.lat,
},
})
await updateUserInfo({ gmsLocation: loc })
toastSuccess(t('settings.GMS.location.updateSuccess'))
userLocation.value = capturedLocation.value
// update in local storage to update button on overview
store.commit('userLocation', loc)
isModalOpen.value = false
} catch (error) {
toastError(error.message)

View File

@ -43,7 +43,7 @@
"card-user-search": {
"headline": "Geografische Mitgliedssuche (experimentell)",
"allowed": {
"button": "Öffne Mitgliedsuche...",
"button": "Öffne Mitgliedssuche...",
"disabled-button": "GMS offline...",
"text": "Finde Mitglieder aller Communities auf einer Landkarte."
},
@ -276,6 +276,7 @@
"recruited-member": "Eingeladenes Mitglied"
},
"h": "h",
"info": "Info",
"language": "Sprache",
"link-load": "den letzten Link nachladen | die letzten {n} Links nachladen",
"link-load-more": "weitere {n} Links nachladen",
@ -334,7 +335,7 @@
"warningText": "Bist du noch da?"
},
"settings": {
"community": "Kreise & Mitgliedsuche",
"community": "Kreise & Mitgliedssuche",
"emailInfo": "Kann aktuell noch nicht geändert werden.",
"GMS": {
"disabled": "Daten werden nicht nach GMS exportiert",

View File

@ -276,6 +276,7 @@
"recruited-member": "Invited member"
},
"h": "h",
"info": "Info",
"language": "Language",
"link-load": "Load the last link | Load the last {n} links",
"link-load-more": "Load more {n} links",

View File

@ -48,6 +48,10 @@ export default defineConfig(async ({ command }) => {
minify: CONFIG.PRODUCTION === true,
},
},
preview: {
host: CONFIG.FRONTEND_MODULE_HOST, // '0.0.0.0',
port: CONFIG.FRONTEND_MODULE_PORT, // 3000,
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),