From 7e26d6373dabc9dc0b421571655d60bb03b988d2 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Mon, 25 Mar 2024 14:27:41 +0100 Subject: [PATCH 01/17] first steps introducing user search --- frontend/public/img/svg/loupe.png | Bin 0 -> 2368 bytes frontend/src/components/Menu/Sidebar.vue | 4 ++++ frontend/src/graphql/queries.js | 8 ++++++++ frontend/src/routes/routes.js | 6 ++++++ 4 files changed, 18 insertions(+) create mode 100644 frontend/public/img/svg/loupe.png diff --git a/frontend/public/img/svg/loupe.png b/frontend/public/img/svg/loupe.png new file mode 100644 index 0000000000000000000000000000000000000000..ab289e4ada0669350cd98f0e2097fb3741a10306 GIT binary patch literal 2368 zcmV-G3BUGeetij0qYeSyQo#f688(9zPt!o!)H zovW;_va_|jyuR-5@7LJb$;!*!-rkdxm!hPmr>Lr$oSy6J?AY1b@ug~8000P^NklB@lR%+Q7RdCvK^!3%Q-#;-3A4-XFy4-XHI z&p;g2(^b*TcW9d8cUniW>nY(OoHpeq4V035WQYHi3erv4Ohea`8;x*PwuzKN1h)`E z%A_q0S!fpJ`aW=4r%%9FXR(Kou$MM@Wr3*ye7#E?3>Ym6q z)+wfh{)cRzCRUvU6a;rRHQ&0X*5en!2?7+wQ`nnTM#OKA>$5;@KdALaEuZS)WRzaa6CH zpIi-#)J5x#;by=Lg$%kvzYBHI1w%ZI?3j5SQQ4JHip|QDCPc+X*u_;jicwcqf>MP37^` zHWfp7Lz~7h6IG7*;iW+~B%`s33|pwGQ9oV6YbR!WPVpO_h8(kldn^sV-Jr~V01R7* zVDSvPm~(9+tc7AR{@3FcbQ)}KAKXHbW4Pry0XK1m@bd$(0_|OfUIj&R((0W*7vSAz#jcyf+528b9sg&FM$&#?rOPma)S0xd6U zdQ(GUiYO=$AR$FQ(PSD%2gn~MxF_$CGckoMsl@UW|4~BfPMzx)07Hd+c>-L@74ksW z_|Y$|_(2~DsFMgxldS^~GZKVTP{ElvHVuK8bcTP!Cj7Fh-$Vkdb^>r(K~%{E z>Ol!*jtJy!8O?QxsopgS%Jc##(MTG(0h}+XyMXG5M8oOx3)1TTT+a}%KywLwRFhGb zzANpjlG*Q8zlW4AU!SxQBo;mN_jS-y(Q^O{siF*h1eNhK%-){i`|lyQ9#WRuDm}vu z(Qx{@9;qz_4u7fqp+31F^@mU_Of(#j4dc?^dCU24do8THA20NlEoK2^yw3gc>@eL@d+X@ zDoL>oD76vSylbF1l;YpViu5{9eQp7S8G*vDwn1;ka`cfd0iEjMCs03nl_yI^{{yPF zp%)ZG=&+gk_TCmaKtxYzpvxGF`W!z_^#h|H%>oL~aAgR*BY~T>eFL{mNDFN}psSGr zHCzO*Axrufr7_^9a90<)e<@mqi_nmm1_Cdu0kSj}AvIjxL(DM1tKOt1Yxdz4ma&;b z_pHgPdY6Dw?;UVf7?cvO%la`$5GMeS;5*P%MZIglFPtStcG`iDQx(G<=mUV{`!I*` zw$AX<68R3RX%d8QlfGesjE$8Hn>f~>f@XAwoUs8IP_F4$dW^Cdc97*I!V$1J4Mypr zLHu{w3+tQw!uSsOL5mt2JBASz)d>`pqG+xznJ_xsd-A@^sNH%d%W{i!`@3 z+&^2O%kW{s+cOG&xvrym!X1BgeO{O{_ZhSs)RD-p%;@)S^WTc%wVyadi_EPQO*!j$ zg4g-<;eLi-rr6N6XuY|@_Sf5mTToX-U3Nuq{Uq+B63i5*B(0LgO@VoO8b%Pk(}7T1 z`pG?l+h*5wa<-7%x@c@+^%%jMSTwr41;(w5wiNwN=!yi_g%kE&+@^@%MrdyfJ-1~l zc8XsWQtNV|D{kxRaO{HmHCbR79J$a`>hy(1eu`g3GS>aeT$9ho8|Y{Gdtpc8L{&;% zThI_rwfS{%$8kVkV2EE(>8b(7Z!b6y)ZLO-`2!m%WUlW!Y&cc#|IkHW`lw0o{BDp? zZK1E`SikS$LQwaZl!LmF_j8m<37&L>*2eFyD1Lpd%QUmH6q!s*W9h|kbKywQ*#{Kj z$-K*z1ZWDmufokIw#s;D{fv#fUECwy7Ud>UhtH6TOo-jT!-q&!vZ;#gpt}Dv3+fSZ zy)K%nT<%boRkKVf0iQ+#cq>tg1vQ3DR_x=8X>N={e>mE#lNw6F@Qo1QnAuu*i?^ac?YU1aHJOANCv zl7AhV14co83x-BPWo)HM34@@%yhHqhf#QqDZAU=5Nc_DTP5`>7SXzVgKr5*4;0;gE z2&#Pb)Zz*^6lKfUlb8ijd-3F5Em%AD@}N9DMwa5ObnuADGEp+iq{`u!@vn|(+RW#L m_35~WhlhuUhlhv9lj0w#DruV595(&{0000 {{ $t('navigation.info') }} + + + {{ $t('usersearch') }} +
diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 9f961e402..87914ca6a 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -19,6 +19,14 @@ export const verifyLogin = gql` } } ` +export const authenticateGmsUserSearch = gql` + query { + authenticateGmsUserSearch { + gmsPlaygroundUri + } + } +` + export const transactionsQuery = gql` query($currentPage: Int = 1, $pageSize: Int = 25, $order: Order = DESC) { diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 869151618..57f8fdd32 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -80,6 +80,12 @@ const routes = [ pageTitle: 'information', }, }, + { + path: '/usersearch', + redirect: (to) => { + return { path: '/login' } + }, + }, // { // path: '/storys', // component: () => import('@/pages/TopStorys'), From 7781a088d0bd1ec8a5865ba5ca234614493e7396 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Tue, 26 Mar 2024 02:54:22 +0100 Subject: [PATCH 02/17] with graphql-Anbindung and frontend tries --- frontend/src/pages/UserSearch.vue | 45 +++++++++++++++++++++++++++++++ frontend/src/routes/routes.js | 7 +++++ 2 files changed, 52 insertions(+) create mode 100644 frontend/src/pages/UserSearch.vue diff --git a/frontend/src/pages/UserSearch.vue b/frontend/src/pages/UserSearch.vue new file mode 100644 index 000000000..8ceeb9ac6 --- /dev/null +++ b/frontend/src/pages/UserSearch.vue @@ -0,0 +1,45 @@ + + + + diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 57f8fdd32..8c8022c06 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -82,9 +82,16 @@ const routes = [ }, { path: '/usersearch', + component: () => import('@/pages/UserSearch'), + meta: { + requiresAuth: true, + pageTitle: 'user search', + }, + /* redirect: (to) => { return { path: '/login' } }, + */ }, // { // path: '/storys', From 4f724543e9bc11c64b10b4a89032aa2acd724fae Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Wed, 27 Mar 2024 02:57:51 +0100 Subject: [PATCH 03/17] next try for menu-entry userplayground --- backend/src/apis/gms/GmsClient.ts | 10 ++++---- .../model/GmsUserAuthenticationResult.ts | 10 ++++++++ backend/src/graphql/resolver/UserResolver.ts | 13 +++++----- .../util/authenticateGmsUserPlayground.ts | 15 ++++++++---- backend/src/seeds/graphql/queries.ts | 3 ++- frontend/src/components/Menu/Sidebar.vue | 4 ++-- frontend/src/graphql/queries.js | 4 ++-- frontend/src/locales/de.json | 3 ++- frontend/src/locales/en.json | 3 ++- frontend/src/locales/fr.json | 3 ++- frontend/src/pages/UserSearch.vue | 24 ++++++++++--------- frontend/src/routes/routes.js | 5 ---- 12 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 backend/src/graphql/model/GmsUserAuthenticationResult.ts diff --git a/backend/src/apis/gms/GmsClient.ts b/backend/src/apis/gms/GmsClient.ts index 46cf38e54..b39a46a4f 100644 --- a/backend/src/apis/gms/GmsClient.ts +++ b/backend/src/apis/gms/GmsClient.ts @@ -202,7 +202,7 @@ export async function verifyAuthToken( } try { const result = await axios.get(baseUrl.concat(service), config) - logger.debug('GET-Response of verify-auth-token:', result) + console.log('GET-Response of verify-auth-token:', result) if (result.status !== 200) { throw new LogError( 'HTTP Status Error in verify-auth-token:', @@ -210,11 +210,11 @@ export async function verifyAuthToken( result.statusText, ) } - logger.debug('responseData:', result.data.responseData) + console.log('responseData:', result.data.responseData) // eslint-disable-next-line @typescript-eslint/no-unsafe-call - const playgroundUri: string = JSON.parse(result.data.responseData.data) - logger.debug('verifyAuthToken=', playgroundUri) - return playgroundUri + const token: string = result.data.responseData.token + console.log('verifyAuthToken=', token) + return token } catch (error: any) { logger.error('Error in verifyAuthToken:', error) throw new LogError(error.message) diff --git a/backend/src/graphql/model/GmsUserAuthenticationResult.ts b/backend/src/graphql/model/GmsUserAuthenticationResult.ts new file mode 100644 index 000000000..b1fb2c246 --- /dev/null +++ b/backend/src/graphql/model/GmsUserAuthenticationResult.ts @@ -0,0 +1,10 @@ +import { Field, ObjectType } from 'type-graphql' + +@ObjectType() +export class GmsUserAuthenticationResult { + @Field(() => String) + url: string + + @Field(() => String) + token: string +} diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 44ae3e722..cbeb740f1 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -79,6 +79,7 @@ import { Location2Point } from './util/Location2Point' import { setUserRole, deleteUserRole } from './util/modifyUserRole' import { sendUserToGms } from './util/sendUserToGms' import { validateAlias } from './util/validateAlias' +import { GmsUserAuthenticationResult } from '../model/GmsUserAuthenticationResult' const LANGUAGES = ['de', 'en', 'es', 'fr', 'nl'] const DEFAULT_LANGUAGE = 'de' @@ -676,18 +677,18 @@ export class UserResolver { } @Authorized([RIGHTS.GMS_USER_PLAYGROUND]) - @Query(() => String) - async authenticateGmsUserSearch(@Ctx() context: Context): Promise { + @Query(() => GmsUserAuthenticationResult) + async authenticateGmsUserSearch(@Ctx() context: Context): Promise { logger.info(`authUserForGmsUserSearch()...`) const dbUser = getUser(context) - let gmsPlaygroundUri: string + let result: GmsUserAuthenticationResult if (context.token) { - gmsPlaygroundUri = await authenticateGmsUserPlayground(context.token, dbUser) - logger.debug('authUserForGmsUserSearch=', gmsPlaygroundUri) + result = await authenticateGmsUserPlayground(context.token, dbUser) + console.log('authUserForGmsUserSearch=', result) } else { throw new LogError('authUserForGmsUserSearch without token') } - return gmsPlaygroundUri + return result } @Authorized([RIGHTS.SEARCH_ADMIN_USERS]) diff --git a/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts b/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts index 5ad51ee42..53c752b5d 100644 --- a/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts +++ b/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts @@ -1,9 +1,16 @@ import { User as DbUser } from '@entity/User' import { verifyAuthToken } from '@/apis/gms/GmsClient' +import { CONFIG } from '@/config' +import { GmsUserAuthenticationResult } from '@/graphql/model/GmsUserAuthenticationResult' -export async function authenticateGmsUserPlayground(token: string, dbUser: DbUser): Promise { - const gmsPlaygroundUri = await verifyAuthToken(dbUser.communityUuid, token) - - return gmsPlaygroundUri +export async function authenticateGmsUserPlayground( + token: string, + dbUser: DbUser, +): Promise { + const result = new GmsUserAuthenticationResult() + result.url = CONFIG.GMS_URL.concat('/playground') + result.token = await verifyAuthToken(dbUser.communityUuid, token) + console.log('GmsUserAuthenticationResult:', result) + return result } diff --git a/backend/src/seeds/graphql/queries.ts b/backend/src/seeds/graphql/queries.ts index 904b097fc..b097a2710 100644 --- a/backend/src/seeds/graphql/queries.ts +++ b/backend/src/seeds/graphql/queries.ts @@ -18,7 +18,8 @@ export const verifyLogin = gql` export const authenticateGmsUserSearch = gql` query { authenticateGmsUserSearch { - gmsPlaygroundUri + url + token } } ` diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index 8f6176b03..8e19acb15 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -28,13 +28,13 @@ {{ $t('GDT') }} - + {{ $t('navigation.info') }} - {{ $t('usersearch') }} + {{ $t('navigation.usersearch') }}
diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 87914ca6a..696963b78 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -22,12 +22,12 @@ export const verifyLogin = gql` export const authenticateGmsUserSearch = gql` query { authenticateGmsUserSearch { - gmsPlaygroundUri + url + token } } ` - export const transactionsQuery = gql` query($currentPage: Int = 1, $pageSize: Int = 25, $order: Order = DESC) { transactionList(currentPage: $currentPage, pageSize: $pageSize, order: $order) { diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 1c37d5e24..bae15f0de 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -268,7 +268,8 @@ "send": "Senden", "settings": "Einstellung", "support": "Support", - "transactions": "Transaktionen" + "transactions": "Transaktionen", + "usersearch": "Nutzersuche" }, "openHours": "Offene Stunden", "pageTitle": { diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 7c607ecbb..4a4fe4c7f 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -268,7 +268,8 @@ "send": "Send", "settings": "Settings", "support": "Support", - "transactions": "Transactions" + "transactions": "Transactions", + "usersearch": "User Search" }, "openHours": "Open Hours", "pageTitle": { diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index 94bac00a6..fef19e169 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -250,7 +250,8 @@ "send": "Envoyer", "settings": "Configuration", "support": "Aide", - "transactions": "Transactions" + "transactions": "Transactions", + "usersearch": "Recherche d'Utilisateur" }, "openHours": "Heures ouverte", "pageTitle": { diff --git a/frontend/src/pages/UserSearch.vue b/frontend/src/pages/UserSearch.vue index 8ceeb9ac6..465f19bdd 100644 --- a/frontend/src/pages/UserSearch.vue +++ b/frontend/src/pages/UserSearch.vue @@ -10,18 +10,10 @@ export default { name: 'GMS User Playground', data() { return { - gmsPlaygroundUri: '', + gmsPlaygroundUrl: 'unknown', + gmsAuthToken: '', } }, - /* - async mounted() { - let query = `{ - authenticateGmsUserSearch() { - gmsPlaygroundUri - } - }`; - }, - */ methods: { authenticateGmsUserPlayground() { this.$apollo @@ -29,13 +21,23 @@ export default { query: authenticateGmsUserSearch, }) .then((result) => { - this.gmsPlaygroundUri = result.data.authenticateGmsUserSearch.gmsPlaygroundUri + this.gmsPlaygroundUrl = result.data.url, + this.gmsAuthToken = result.data.token }) .catch(() => { this.toastError('listContributionLinks has no result, use default data') }) }, }, + /* + openGmsUserPlayground: function () { + // window.open(this.gmsPlaygroundUrl + '?' + this.gmsAuthToken, '_blank') + let uri = this.gmsPlaygroundUrl + '?' + this.gmsAuthToken + let route = this.$router.resolve({path: uri}); + // let route = this.$router.resolve('/link/to/page'); // This also works. + window.open(route.href, '_blank'); + }, + */ created() { this.authenticateGmsUserPlayground() }, diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 8c8022c06..2636b963b 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -87,11 +87,6 @@ const routes = [ requiresAuth: true, pageTitle: 'user search', }, - /* - redirect: (to) => { - return { path: '/login' } - }, - */ }, // { // path: '/storys', From 48516e7f463e40fb327303a69362d026f46dfdda Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Thu, 4 Apr 2024 21:56:41 +0200 Subject: [PATCH 04/17] create page for usersearch --- frontend/src/components/Menu/Sidebar.vue | 2 +- frontend/src/locales/de.json | 8 +++- frontend/src/locales/en.json | 8 +++- frontend/src/locales/fr.json | 8 +++- frontend/src/pages/UserSearch.vue | 57 ++++++++++++++++-------- frontend/src/routes/routes.js | 2 +- 6 files changed, 62 insertions(+), 23 deletions(-) diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index 8e19acb15..2421c82c2 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -28,7 +28,7 @@ {{ $t('GDT') }} - + {{ $t('navigation.info') }} diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index bae15f0de..f2f4f6205 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -279,7 +279,8 @@ "overview": "Willkommen {name}", "send": "Sende Gradidos", "settings": "Einstellungen", - "transactions": "Deine Transaktionen" + "transactions": "Deine Transaktionen", + "usersearch": "GMS Nutzersuche" }, "qrCode": "QR Code", "send_gdd": "GDD versenden", @@ -412,6 +413,11 @@ "transaction-link": { "send_you": "sendet dir" }, + "usersearch": { + "headline": "Gradido GMS-Nutzersuche", + "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden.", + "button": "Starte die Nutzersuche..." + }, "via_link": "über einen Link", "welcome": "Willkommen in der Gemeinschaft" } diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 4a4fe4c7f..c3bf40e29 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -279,7 +279,8 @@ "overview": "Welcome {name}", "send": "Send Gradidos", "settings": "Settings", - "transactions": "Your transactions" + "transactions": "Your transactions", + "usersearch": "GMS User-Search" }, "qrCode": "QR Code", "send_gdd": "Send GDD", @@ -412,6 +413,11 @@ "transaction-link": { "send_you": "wants to send you" }, + "usersearch": { + "headline": "Gradido GMS-UserSearch", + "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden.", + "button": "Start the User-Search..." + }, "via_link": "via Link", "welcome": "Welcome to the community" } diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index fef19e169..4581a3c07 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -261,7 +261,8 @@ "overview": "Bienvenue {name}", "send": "Envoyé Gradidos", "settings": "Configuration", - "transactions": "Vos transactions" + "transactions": "Vos transactions", + "usersearch": "GMS Recherche d'Utilisateur" }, "qrCode": "QR Code", "send_gdd": "Envoyer GDD", @@ -353,6 +354,11 @@ "transaction-link": { "send_you": "veut vous envoyer" }, + "usersearch": { + "headline": "Gradido GMS-Recherche d'Utilisateur", + "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden.", + "button": "Lancer le Recherche d'Utilisateur..." + }, "via_link": "par lien", "welcome": "Bienvenu dans la communauté" } diff --git a/frontend/src/pages/UserSearch.vue b/frontend/src/pages/UserSearch.vue index 465f19bdd..9e55d487f 100644 --- a/frontend/src/pages/UserSearch.vue +++ b/frontend/src/pages/UserSearch.vue @@ -1,47 +1,68 @@ - - diff --git a/frontend/src/routes/routes.js b/frontend/src/routes/routes.js index 2636b963b..d8f85b858 100755 --- a/frontend/src/routes/routes.js +++ b/frontend/src/routes/routes.js @@ -85,7 +85,7 @@ const routes = [ component: () => import('@/pages/UserSearch'), meta: { requiresAuth: true, - pageTitle: 'user search', + pageTitle: 'usersearch', }, }, // { From ba4484e9fdc742622c6cf0827f457b2ac4861075 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Thu, 4 Apr 2024 22:03:18 +0200 Subject: [PATCH 05/17] adapt result of authenticated gms playground for new frontend page --- backend/src/apis/gms/GmsClient.ts | 12 +++++++++--- backend/src/config/index.ts | 5 +++-- .../resolver/util/authenticateGmsUserPlayground.ts | 6 +++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/backend/src/apis/gms/GmsClient.ts b/backend/src/apis/gms/GmsClient.ts index 32a3802ff..6708c5fc2 100644 --- a/backend/src/apis/gms/GmsClient.ts +++ b/backend/src/apis/gms/GmsClient.ts @@ -118,7 +118,9 @@ export async function userByUuid(uuid: string): Promise { if (CONFIG.GMS_ACTIVE) { - const baseUrl = CONFIG.GMS_URL.endsWith('/') ? CONFIG.GMS_URL : CONFIG.GMS_URL.concat('/') + const baseUrl = CONFIG.GMS_API_URL.endsWith('/') + ? CONFIG.GMS_API_URL + : CONFIG.GMS_API_URL.concat('/') const service = 'community-user' const config = { headers: { @@ -152,7 +154,9 @@ export async function createGmsUser(apiKey: string, user: GmsUser): Promise { if (CONFIG.GMS_ACTIVE) { - const baseUrl = CONFIG.GMS_URL.endsWith('/') ? CONFIG.GMS_URL : CONFIG.GMS_URL.concat('/') + const baseUrl = CONFIG.GMS_API_URL.endsWith('/') + ? CONFIG.GMS_API_URL + : CONFIG.GMS_API_URL.concat('/') const service = 'community-user' const config = { headers: { @@ -189,7 +193,9 @@ export async function verifyAuthToken( communityUuid: string, token: string, ): Promise { - const baseUrl = CONFIG.GMS_URL.endsWith('/') ? CONFIG.GMS_URL : CONFIG.GMS_URL.concat('/') + const baseUrl = CONFIG.GMS_API_URL.endsWith('/') + ? CONFIG.GMS_API_URL + : CONFIG.GMS_API_URL.concat('/') const service = 'verify-auth-token?token='.concat(token).concat('&uuid=').concat(communityUuid) const config = { headers: { diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index dd35d180e..56792316f 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -19,7 +19,7 @@ const constants = { LOG_LEVEL: process.env.LOG_LEVEL ?? 'info', CONFIG_VERSION: { DEFAULT: 'DEFAULT', - EXPECTED: 'v22.2024-03-14', + EXPECTED: 'v23.2024-04-04', CURRENT: '', }, } @@ -145,7 +145,8 @@ const gms = { GMS_ACTIVE: process.env.GMS_ACTIVE === 'true' || false, GMS_CREATE_USER_THROW_ERRORS: process.env.GMS_CREATE_USER_THROW_ERRORS === 'true' || false, // koordinates of Illuminz-instance of GMS - GMS_URL: process.env.GMS_HOST ?? 'http://localhost:4044/', + GMS_API_URL: process.env.GMS_API_URL ?? 'http://localhost:4044/', + GMS_DASHBOARD_URL: process.env.GMS_DASHBOARD_URL ?? 'http://localhost:8080/', // used as secret postfix attached at the gms community-auth-url endpoint ('/hook/gms/' + 'secret') GMS_WEBHOOK_SECRET: process.env.GMS_WEBHOOK_SECRET ?? 'secret', } diff --git a/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts b/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts index cad98c683..3f1677244 100644 --- a/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts +++ b/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts @@ -10,7 +10,11 @@ export async function authenticateGmsUserPlayground( dbUser: DbUser, ): Promise { const result = new GmsUserAuthenticationResult() - result.url = CONFIG.GMS_URL.concat('/playground') + const dashboardUrl = CONFIG.GMS_DASHBOARD_URL.endsWith('/') + ? CONFIG.GMS_DASHBOARD_URL + : CONFIG.GMS_DASHBOARD_URL.concat('/') + + result.url = dashboardUrl.concat('playground') result.token = await verifyAuthToken(dbUser.communityUuid, token) logger.info('GmsUserAuthenticationResult:', result) return result From a258a414e8151cfb65a591645e03fa6841b34b28 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Thu, 4 Apr 2024 22:09:18 +0200 Subject: [PATCH 06/17] remove unused code --- frontend/src/pages/UserSearch.vue | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/frontend/src/pages/UserSearch.vue b/frontend/src/pages/UserSearch.vue index 9e55d487f..7123e6619 100644 --- a/frontend/src/pages/UserSearch.vue +++ b/frontend/src/pages/UserSearch.vue @@ -5,9 +5,6 @@
{{ $t('usersearch.text') }}
-
@@ -22,13 +19,11 @@ From 1a40d690976d324a8f6cd3df54aecd6e3612ba73 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Thu, 4 Apr 2024 22:40:17 +0200 Subject: [PATCH 07/17] change config for gms-usage --- backend/.env.dist | 6 ++++-- backend/.env.template | 5 ++++- deployment/bare_metal/.env.dist | 5 +++-- frontend/src/locales/de.json | 2 +- frontend/src/locales/en.json | 2 +- frontend/src/locales/fr.json | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/backend/.env.dist b/backend/.env.dist index 4ec60d856..6a407fa9c 100644 --- a/backend/.env.dist +++ b/backend/.env.dist @@ -68,5 +68,7 @@ FEDERATION_XCOM_SENDCOINS_ENABLED=false # GMS # GMS_ACTIVE=true # Coordinates of Illuminz test instance -#GMS_URL=http://54.176.169.179:3071 -GMS_URL=http://localhost:4044/ +#GMS_API_URL=http://54.176.169.179:3071 +GMS_API_URL=http://localhost:4044/ +GMS_DASHBOARD_URL=http://localhost:8080/ + diff --git a/backend/.env.template b/backend/.env.template index 1cff23d5a..3d1d1298f 100644 --- a/backend/.env.template +++ b/backend/.env.template @@ -66,4 +66,7 @@ FEDERATION_XCOM_SENDCOINS_ENABLED=$FEDERATION_XCOM_SENDCOINS_ENABLED # GMS GMS_ACTIVE=$GMS_ACTIVE -GMS_URL=$GMS_URL +GMS_API_URL=$GMS_API_URL +GMS_DASHBOARD_URL=$GMS_DASHBOARD_URL +GMS_WEBHOOK_SECRET=$GMS_WEBHOOK_SECRET +GMS_CREATE_USER_THROW_ERRORS=$GMS_CREATE_USER_THROW_ERRORS diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 3da4bd319..d3f6c356b 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -122,5 +122,6 @@ WEBHOOK_ELOPAGE_SECRET=secret # GMS GMS_ACTIVE=false # Coordinates of Illuminz test instance -#GMS_URL=http://54.176.169.179:3071 -GMS_URL=http://localhost:4044/ +#GMS_API_URL=http://54.176.169.179:3071 +GMS_API_URL=http://localhost:4044/ +GMS_DASHBOARD_URL=http://localhost:8080/ diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index f2f4f6205..658357e2f 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -415,7 +415,7 @@ }, "usersearch": { "headline": "Gradido GMS-Nutzersuche", - "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden.", + "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden. Mit dem Button wird ein neues Browser-Fenster geöffnet und dir direkt die Nutzer in deinem Umfeld auf einer Karte angezeigt.", "button": "Starte die Nutzersuche..." }, "via_link": "über einen Link", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index c3bf40e29..b0d6b4bb9 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -415,7 +415,7 @@ }, "usersearch": { "headline": "Gradido GMS-UserSearch", - "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden.", + "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden. Mit dem Button wird ein neues Browser-Fenster geöffnet und dir direkt die Nutzer in deinem Umfeld auf einer Karte angezeigt.", "button": "Start the User-Search..." }, "via_link": "via Link", diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index 4581a3c07..28141edbf 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -356,7 +356,7 @@ }, "usersearch": { "headline": "Gradido GMS-Recherche d'Utilisateur", - "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden.", + "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden. Mit dem Button wird ein neues Browser-Fenster geöffnet und dir direkt die Nutzer in deinem Umfeld auf einer Karte angezeigt.", "button": "Lancer le Recherche d'Utilisateur..." }, "via_link": "par lien", From 7366aef1e3ca3c073922b4b8e1c39737553128d5 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Tue, 9 Apr 2024 21:12:26 +0200 Subject: [PATCH 08/17] multi line usersearch text for all supported languages --- frontend/src/locales/de.json | 6 +++--- frontend/src/locales/en.json | 10 +++++----- frontend/src/locales/es.json | 19 ++++++++++++++++++- frontend/src/locales/fr.json | 10 +++++----- frontend/src/locales/nl.json | 19 ++++++++++++++++++- frontend/src/pages/UserSearch.vue | 8 +++++++- 6 files changed, 56 insertions(+), 16 deletions(-) diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 658357e2f..4e68b4efc 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -280,7 +280,7 @@ "send": "Sende Gradidos", "settings": "Einstellungen", "transactions": "Deine Transaktionen", - "usersearch": "GMS Nutzersuche" + "usersearch": "Geografische Nutzersuche" }, "qrCode": "QR Code", "send_gdd": "GDD versenden", @@ -414,8 +414,8 @@ "send_you": "sendet dir" }, "usersearch": { - "headline": "Gradido GMS-Nutzersuche", - "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden. Mit dem Button wird ein neues Browser-Fenster geöffnet und dir direkt die Nutzer in deinem Umfeld auf einer Karte angezeigt.", + "headline": "Geografische Nutzersuche", + "text": "Ganz gleich zu welcher Community du gehörst, mit dem Geo Matching System findest du Mitglieder aller Communities auf einer Landkarte. Du kannst nach Angeboten und Bedürfnissen filtern und dir die Nutzer anzeigen lassen, die zu Dir passen.\n\nMit dem Button wird ein neues Browser-Fenster geöffnet, in dem dir die Nutzer in deinem Umfeld auf einer Karte angezeigt werden.", "button": "Starte die Nutzersuche..." }, "via_link": "über einen Link", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index b0d6b4bb9..364e0a830 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -269,7 +269,7 @@ "settings": "Settings", "support": "Support", "transactions": "Transactions", - "usersearch": "User Search" + "usersearch": "Geographical User Search" }, "openHours": "Open Hours", "pageTitle": { @@ -280,7 +280,7 @@ "send": "Send Gradidos", "settings": "Settings", "transactions": "Your transactions", - "usersearch": "GMS User-Search" + "usersearch": "User search" }, "qrCode": "QR Code", "send_gdd": "Send GDD", @@ -414,9 +414,9 @@ "send_you": "wants to send you" }, "usersearch": { - "headline": "Gradido GMS-UserSearch", - "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden. Mit dem Button wird ein neues Browser-Fenster geöffnet und dir direkt die Nutzer in deinem Umfeld auf einer Karte angezeigt.", - "button": "Start the User-Search..." + "headline": "Geographical User Search", + "text": "No matter which community you belong to, with the Geo Matching System you can find members of all communities on a map. You can filter according to offers and needs and display the users that match you.\n\nThe button opens a new browser window in which the users in your area are displayed on a map.", + "button": "Start user search... " }, "via_link": "via Link", "welcome": "Welcome to the community" diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index 6e52fd9a1..2f3bbf50d 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -242,7 +242,19 @@ "profile": "Mi Perfil", "send": "Enviar", "support": "Soporte", - "transactions": "Transacciones" + "transactions": "Transacciones", + "usersearch": "Buscar usuarios" + }, + "openHours": "Open Hours", + "pageTitle": { + "community": "Create Gradido", + "gdt": "Your GDT transactions", + "information": "{community}", + "overview": "Welcome {name}", + "send": "Enviar Gradidos", + "settings": "Settings", + "transactions": "Your transactions", + "usersearch": "Búsqueda geográfica de usuarios" }, "qrCode": "Código QR", "send_gdd": "Enviar GDD", @@ -334,6 +346,11 @@ "transaction-link": { "send_you": "te envía" }, + "usersearch": { + "headline": "Búsqueda geográfica de usuarios", + "text": "No importa a qué comunidad pertenezcas, con el Geo Matching System puedes encontrar miembros de todas las comunidades en un mapa. Puedes filtrar según ofertas y requisitos y visualizar los usuarios que coinciden con tu perfil.\n\nEl botón abre una nueva ventana del navegador en la que se muestran en un mapa los usuarios de tu zona.", + "button": "Iniciar la búsqueda de usuarios..." + }, "via_link": "atraves de un enlace", "welcome": "Bienvenido a la comunidad." } diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json index 28141edbf..999060f21 100644 --- a/frontend/src/locales/fr.json +++ b/frontend/src/locales/fr.json @@ -251,7 +251,7 @@ "settings": "Configuration", "support": "Aide", "transactions": "Transactions", - "usersearch": "Recherche d'Utilisateur" + "usersearch": "Recherche d'utilisateurs" }, "openHours": "Heures ouverte", "pageTitle": { @@ -262,7 +262,7 @@ "send": "Envoyé Gradidos", "settings": "Configuration", "transactions": "Vos transactions", - "usersearch": "GMS Recherche d'Utilisateur" + "usersearch": "Recherche géographique d'utilisateurs" }, "qrCode": "QR Code", "send_gdd": "Envoyer GDD", @@ -355,9 +355,9 @@ "send_you": "veut vous envoyer" }, "usersearch": { - "headline": "Gradido GMS-Recherche d'Utilisateur", - "text": "Ganz gleich zu welcher Community du gehörst, über die Gradido-Nutzersuche kannst du in einer geographischen Karte deine Community-Mitglieder als auch andere Communities und deren Mitglieder finden. Mit dem Button wird ein neues Browser-Fenster geöffnet und dir direkt die Nutzer in deinem Umfeld auf einer Karte angezeigt.", - "button": "Lancer le Recherche d'Utilisateur..." + "headline": "Recherche géographique d'utilisateurs", + "text": "Quelle que soit la communauté à laquelle tu appartiens, le système de géo-matching te permet de trouver des membres de toutes les communautés sur une carte géographique. Tu peux filtrer selon les offres et les besoins et afficher les utilisateurs qui te correspondent.\n\nEn cliquant sur le bouton, une nouvelle fenêtre de navigateur s'ouvre et t'affiche les utilisateurs de ton entourage sur une carte.", + "button": "Commence la recherche d'utilisateurs..." }, "via_link": "par lien", "welcome": "Bienvenu dans la communauté" diff --git a/frontend/src/locales/nl.json b/frontend/src/locales/nl.json index a1f612f39..2e50f2968 100644 --- a/frontend/src/locales/nl.json +++ b/frontend/src/locales/nl.json @@ -242,7 +242,19 @@ "profile": "Mijn profiel", "send": "Sturen", "support": "Support", - "transactions": "Transacties" + "transactions": "Transacties", + "usersearch": "Gebruiker zoeken" + }, + "openHours": "Open Hours", + "pageTitle": { + "community": "Create Gradido", + "gdt": "Your GDT transactions", + "information": "{community}", + "overview": "Welcome {name}", + "send": "Send Gradidos", + "settings": "Settings", + "transactions": "Your transactions", + "usersearch": "Geografisch zoeken naar gebruikers" }, "qrCode": "QR Code", "send_gdd": "GDD sturen", @@ -334,6 +346,11 @@ "transaction-link": { "send_you": "stuurt jou" }, + "usersearch": { + "headline": "Geografisch zoeken naar gebruikers", + "text": "Het maakt niet uit tot welke community je behoort, met het Geo Matching System kun je leden van alle communities vinden op een kaart. Je kunt filteren op aanbiedingen en vereisten en de gebruikers weergeven die aan je profiel voldoen.\n\nDe knop opent een nieuw browservenster waarin de gebruikers in je omgeving op een kaart worden weergegeven.", + "button": "Start het zoeken naar gebruikers..." + }, "via_link": "via een link", "welcome": "Welkom in de gemeenschap" } diff --git a/frontend/src/pages/UserSearch.vue b/frontend/src/pages/UserSearch.vue index 7123e6619..070a96d7b 100644 --- a/frontend/src/pages/UserSearch.vue +++ b/frontend/src/pages/UserSearch.vue @@ -3,7 +3,13 @@
{{ $t('usersearch.headline') }}
- {{ $t('usersearch.text') }} + + {{ line }} +
+
From 6c31480e31c7b97d0f366eab099b59d82629347a Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Tue, 9 Apr 2024 21:24:29 +0200 Subject: [PATCH 09/17] correct pagetitles for language, but still needs a review --- frontend/src/locales/en.json | 2 +- frontend/src/locales/es.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 364e0a830..9db96439e 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -280,7 +280,7 @@ "send": "Send Gradidos", "settings": "Settings", "transactions": "Your transactions", - "usersearch": "User search" + "usersearch": "Geographical User Search" }, "qrCode": "QR Code", "send_gdd": "Send GDD", diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index 2f3bbf50d..bc5479029 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -248,12 +248,12 @@ "openHours": "Open Hours", "pageTitle": { "community": "Create Gradido", - "gdt": "Your GDT transactions", + "gdt": "Tu GDT Transacciones", "information": "{community}", "overview": "Welcome {name}", "send": "Enviar Gradidos", - "settings": "Settings", - "transactions": "Your transactions", + "settings": "Soporte", + "transactions": "Tu Transacciones", "usersearch": "Búsqueda geográfica de usuarios" }, "qrCode": "Código QR", From 051e7212f29a972c28fb0d0e10c938dd0e67cd77 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Wed, 10 Apr 2024 18:13:50 +0200 Subject: [PATCH 10/17] add tests for usersearch --- frontend/src/components/Menu/Sidebar.spec.js | 6 +- frontend/src/pages/UserSearch.spec.js | 80 ++++++++++++++++++++ frontend/src/routes/router.test.js | 15 +++- 3 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 frontend/src/pages/UserSearch.spec.js diff --git a/frontend/src/components/Menu/Sidebar.spec.js b/frontend/src/components/Menu/Sidebar.spec.js index 23c855557..77a525f3b 100644 --- a/frontend/src/components/Menu/Sidebar.spec.js +++ b/frontend/src/components/Menu/Sidebar.spec.js @@ -34,7 +34,7 @@ describe('Sidebar', () => { describe('the genaral section', () => { it('has six nav-items', () => { - expect(wrapper.findAll('ul').at(0).findAll('.nav-item')).toHaveLength(6) + expect(wrapper.findAll('ul').at(0).findAll('.nav-item')).toHaveLength(7) }) it('has nav-item "navigation.overview" in navbar', () => { @@ -60,6 +60,10 @@ describe('Sidebar', () => { it('has nav-item "navigation.info" in navbar', () => { expect(wrapper.findAll('.nav-item').at(5).text()).toContain('navigation.info') }) + + it('has nav-item "usersearch" in navbar', () => { + expect(wrapper.findAll('.nav-item').at(6).text()).toContain('navigation.usersearch') + }) }) describe('the specific section', () => { diff --git a/frontend/src/pages/UserSearch.spec.js b/frontend/src/pages/UserSearch.spec.js new file mode 100644 index 000000000..20116b523 --- /dev/null +++ b/frontend/src/pages/UserSearch.spec.js @@ -0,0 +1,80 @@ +import { mount, RouterLinkStub } from '@vue/test-utils' +import UserSearch from './UserSearch' +import { toastErrorSpy } from '../../test/testSetup' +import { authenticateGmsUserSearch } from '@/graphql/queries' + +const localVue = global.localVue + +window.scrollTo = jest.fn() + +const stubs = { + RouterLink: RouterLinkStub, +} + +const apolloQueryMock = jest + .fn() + .mockResolvedValueOnce({ + data: { + authenticateGmsUserSearch: { + gmsUri: 'http://localhost:8080/playground?not initialized', + }, + }, + }) + .mockResolvedValue('default') + + +describe('UserSearch', () => { + let wrapper + + const mocks = { + $t: jest.fn((t) => t), + $n: jest.fn(), + $i18n: { + locale: 'en', + }, + $apollo: { + query: apolloQueryMock, + }, + } + + const Wrapper = () => { + return mount(UserSearch, { + localVue, + mocks, + }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the usersearch page', () => { + expect(wrapper.find('div.usersearch').exists()).toBeTruthy() + }) + + it('calls authenticateGmsUserSearch', () => { + expect(apolloQueryMock).toBeCalledWith( + expect.objectContaining({ + query: authenticateGmsUserSearch, + }), + ) + }) + + describe('error apolloQueryMock', () => { + beforeEach(async () => { + jest.clearAllMocks() + apolloQueryMock.mockRejectedValue({ + message: 'uups', + }) + wrapper = Wrapper() + }) + + it('toasts an error message', () => { + expect(toastErrorSpy).toBeCalledWith( + 'authenticateGmsUserSearch failed!', + ) + }) + }) + }) +}) diff --git a/frontend/src/routes/router.test.js b/frontend/src/routes/router.test.js index 6d7e7b2a0..af6b1c431 100644 --- a/frontend/src/routes/router.test.js +++ b/frontend/src/routes/router.test.js @@ -49,8 +49,8 @@ describe('router', () => { expect(routes.find((r) => r.path === '/').redirect()).toEqual({ path: '/login' }) }) - it('has 19 routes defined', () => { - expect(routes).toHaveLength(19) + it('has 20 routes defined', () => { + expect(routes).toHaveLength(20) }) describe('overview', () => { @@ -142,6 +142,17 @@ describe('router', () => { }) }) + describe('usersearch', () => { + it('requires authorization', () => { + expect(routes.find((r) => r.path === '/usersearch').meta.requiresAuth).toBeTruthy() + }) + + it('loads the "UserSearch" page', async () => { + const component = await routes.find((r) => r.path === '/usersearch').component() + expect(component.default.name).toBe('UserSearch') + }) + }) + describe('gdt', () => { it('requires authorization', () => { expect(routes.find((r) => r.path === '/gdt').meta.requiresAuth).toBeTruthy() From 569a89ce2dc74796ed837e0b2b388cb40ac80509 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Wed, 10 Apr 2024 21:02:22 +0200 Subject: [PATCH 11/17] linting --- frontend/src/pages/UserSearch.spec.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/frontend/src/pages/UserSearch.spec.js b/frontend/src/pages/UserSearch.spec.js index 20116b523..7a991ac0f 100644 --- a/frontend/src/pages/UserSearch.spec.js +++ b/frontend/src/pages/UserSearch.spec.js @@ -1,4 +1,4 @@ -import { mount, RouterLinkStub } from '@vue/test-utils' +import { mount } from '@vue/test-utils' import UserSearch from './UserSearch' import { toastErrorSpy } from '../../test/testSetup' import { authenticateGmsUserSearch } from '@/graphql/queries' @@ -7,10 +7,6 @@ const localVue = global.localVue window.scrollTo = jest.fn() -const stubs = { - RouterLink: RouterLinkStub, -} - const apolloQueryMock = jest .fn() .mockResolvedValueOnce({ @@ -22,7 +18,6 @@ const apolloQueryMock = jest }) .mockResolvedValue('default') - describe('UserSearch', () => { let wrapper @@ -71,9 +66,7 @@ describe('UserSearch', () => { }) it('toasts an error message', () => { - expect(toastErrorSpy).toBeCalledWith( - 'authenticateGmsUserSearch failed!', - ) + expect(toastErrorSpy).toBeCalledWith('authenticateGmsUserSearch failed!') }) }) }) From e44da4d6a3298bdd0247cf7d0f76ed21bbb17989 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Thu, 11 Apr 2024 00:40:38 +0200 Subject: [PATCH 12/17] rework review comments --- backend/src/apis/gms/GmsClient.ts | 19 +++++++------------ backend/src/util/utilities.ts | 4 ++++ deployment/bare_metal/.env.dist | 2 ++ frontend/public/img/{svg => }/loupe.png | Bin frontend/src/components/Menu/Sidebar.vue | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) rename frontend/public/img/{svg => }/loupe.png (100%) diff --git a/backend/src/apis/gms/GmsClient.ts b/backend/src/apis/gms/GmsClient.ts index 6708c5fc2..e5ce08bbf 100644 --- a/backend/src/apis/gms/GmsClient.ts +++ b/backend/src/apis/gms/GmsClient.ts @@ -9,10 +9,11 @@ import { LogError } from '@/server/LogError' import { backendLogger as logger } from '@/server/logger' import { GmsUser } from './model/GmsUser' +import { ensureUrlEndsWithSlash } from '@/util/utilities' /* export async function communityList(): Promise { - const baseUrl = CONFIG.GMS_URL.endsWith('/') ? CONFIG.GMS_URL : CONFIG.GMS_URL.concat('/') + const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_URL) const service = 'community/list?page=1&perPage=20' const config = { headers: { @@ -44,7 +45,7 @@ export async function communityList(): Promise { - const baseUrl = CONFIG.GMS_URL.endsWith('/') ? CONFIG.GMS_URL : CONFIG.GMS_URL.concat('/') + const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_URL) const service = 'community-user/list?page=1&perPage=20' const config = { headers: { @@ -80,7 +81,7 @@ export async function userList(): Promise { } export async function userByUuid(uuid: string): Promise { - const baseUrl = CONFIG.GMS_URL.endsWith('/') ? CONFIG.GMS_URL : CONFIG.GMS_URL.concat('/') + const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_URL) const service = 'community-user/list?page=1&perPage=20' const config = { headers: { @@ -118,9 +119,7 @@ export async function userByUuid(uuid: string): Promise { if (CONFIG.GMS_ACTIVE) { - const baseUrl = CONFIG.GMS_API_URL.endsWith('/') - ? CONFIG.GMS_API_URL - : CONFIG.GMS_API_URL.concat('/') + const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_API_URL) const service = 'community-user' const config = { headers: { @@ -154,9 +153,7 @@ export async function createGmsUser(apiKey: string, user: GmsUser): Promise { if (CONFIG.GMS_ACTIVE) { - const baseUrl = CONFIG.GMS_API_URL.endsWith('/') - ? CONFIG.GMS_API_URL - : CONFIG.GMS_API_URL.concat('/') + const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_API_URL) const service = 'community-user' const config = { headers: { @@ -193,9 +190,7 @@ export async function verifyAuthToken( communityUuid: string, token: string, ): Promise { - const baseUrl = CONFIG.GMS_API_URL.endsWith('/') - ? CONFIG.GMS_API_URL - : CONFIG.GMS_API_URL.concat('/') + const baseUrl = ensureUrlEndsWithSlash(CONFIG.GMS_API_URL) const service = 'verify-auth-token?token='.concat(token).concat('&uuid=').concat(communityUuid) const config = { headers: { diff --git a/backend/src/util/utilities.ts b/backend/src/util/utilities.ts index c3895cb9e..bc2c2198a 100644 --- a/backend/src/util/utilities.ts +++ b/backend/src/util/utilities.ts @@ -29,3 +29,7 @@ export function resetInterface>(obj: T): T { } return obj } + +export const ensureUrlEndsWithSlash = (url: string): string => { + return url.endsWith('/') ? url : url.concat('/') +} diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index d3f6c356b..64ba8f66b 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -125,3 +125,5 @@ GMS_ACTIVE=false #GMS_API_URL=http://54.176.169.179:3071 GMS_API_URL=http://localhost:4044/ GMS_DASHBOARD_URL=http://localhost:8080/ +GMS_WEBHOOK_SECRET=secret +GMS_CREATE_USER_THROW_ERRORS=false \ No newline at end of file diff --git a/frontend/public/img/svg/loupe.png b/frontend/public/img/loupe.png similarity index 100% rename from frontend/public/img/svg/loupe.png rename to frontend/public/img/loupe.png diff --git a/frontend/src/components/Menu/Sidebar.vue b/frontend/src/components/Menu/Sidebar.vue index 2421c82c2..227275786 100644 --- a/frontend/src/components/Menu/Sidebar.vue +++ b/frontend/src/components/Menu/Sidebar.vue @@ -33,7 +33,7 @@ {{ $t('navigation.info') }} - + {{ $t('navigation.usersearch') }} From 6f71c3a4e4c2e7c0aa5e886042144147ed7cb729 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Thu, 11 Apr 2024 00:44:48 +0200 Subject: [PATCH 13/17] linting --- backend/src/apis/gms/GmsClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/apis/gms/GmsClient.ts b/backend/src/apis/gms/GmsClient.ts index e5ce08bbf..a59f7f6b5 100644 --- a/backend/src/apis/gms/GmsClient.ts +++ b/backend/src/apis/gms/GmsClient.ts @@ -7,9 +7,9 @@ import axios from 'axios' import { CONFIG } from '@/config' import { LogError } from '@/server/LogError' import { backendLogger as logger } from '@/server/logger' +import { ensureUrlEndsWithSlash } from '@/util/utilities' import { GmsUser } from './model/GmsUser' -import { ensureUrlEndsWithSlash } from '@/util/utilities' /* export async function communityList(): Promise { From eac886e7b2af8255fdc9427972608fbf8be9d265 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Thu, 11 Apr 2024 16:42:09 +0200 Subject: [PATCH 14/17] refactor to use ensureUrlEndsWithSlash() instead of duplicate code --- backend/src/federation/authenticateCommunities.ts | 5 ++--- backend/src/federation/client/1_0/AuthenticationClient.ts | 5 ++--- backend/src/federation/client/1_0/FederationClient.ts | 5 ++--- backend/src/federation/client/1_0/SendCoinsClient.ts | 5 ++--- backend/src/federation/client/FederationClientFactory.ts | 6 ++---- backend/src/graphql/model/FederatedCommunity.ts | 4 +++- .../graphql/resolver/util/authenticateGmsUserPlayground.ts | 5 ++--- 7 files changed, 15 insertions(+), 20 deletions(-) diff --git a/backend/src/federation/authenticateCommunities.ts b/backend/src/federation/authenticateCommunities.ts index 8da8306fd..56899d4b0 100644 --- a/backend/src/federation/authenticateCommunities.ts +++ b/backend/src/federation/authenticateCommunities.ts @@ -6,6 +6,7 @@ import { CONFIG } from '@/config' // eslint-disable-next-line camelcase import { AuthenticationClient as V1_0_AuthenticationClient } from '@/federation/client/1_0/AuthenticationClient' import { backendLogger as logger } from '@/server/logger' +import { ensureUrlEndsWithSlash } from '@/util/utilities' import { OpenConnectionArgs } from './client/1_0/model/OpenConnectionArgs' import { AuthenticationClientFactory } from './client/AuthenticationClientFactory' @@ -39,9 +40,7 @@ export async function startCommunityAuthentication( const args = new OpenConnectionArgs() args.publicKey = homeCom.publicKey.toString('hex') // TODO encrypt url with foreignCom.publicKey and sign it with homeCom.privateKey - args.url = homeFedCom.endPoint.endsWith('/') - ? homeFedCom.endPoint - : homeFedCom.endPoint + '/' + homeFedCom.apiVersion + args.url = ensureUrlEndsWithSlash(homeFedCom.endPoint).concat(homeFedCom.apiVersion) logger.debug( 'Authentication: before client.openConnection() args:', homeCom.publicKey.toString('hex'), diff --git a/backend/src/federation/client/1_0/AuthenticationClient.ts b/backend/src/federation/client/1_0/AuthenticationClient.ts index f73393255..6ee69d00d 100644 --- a/backend/src/federation/client/1_0/AuthenticationClient.ts +++ b/backend/src/federation/client/1_0/AuthenticationClient.ts @@ -2,6 +2,7 @@ import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCom import { GraphQLClient } from 'graphql-request' import { backendLogger as logger } from '@/server/logger' +import { ensureUrlEndsWithSlash } from '@/util/utilities' import { OpenConnectionArgs } from './model/OpenConnectionArgs' import { openConnection } from './query/openConnection' @@ -13,9 +14,7 @@ export class AuthenticationClient { constructor(dbCom: DbFederatedCommunity) { this.dbCom = dbCom - this.endpoint = `${dbCom.endPoint.endsWith('/') ? dbCom.endPoint : dbCom.endPoint + '/'}${ - dbCom.apiVersion - }/` + this.endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion) this.client = new GraphQLClient(this.endpoint, { method: 'POST', jsonSerializer: { diff --git a/backend/src/federation/client/1_0/FederationClient.ts b/backend/src/federation/client/1_0/FederationClient.ts index b9939a12c..4612e6d62 100644 --- a/backend/src/federation/client/1_0/FederationClient.ts +++ b/backend/src/federation/client/1_0/FederationClient.ts @@ -4,6 +4,7 @@ import { GraphQLClient } from 'graphql-request' import { getPublicCommunityInfo } from '@/federation/client/1_0/query/getPublicCommunityInfo' import { getPublicKey } from '@/federation/client/1_0/query/getPublicKey' import { backendLogger as logger } from '@/server/logger' +import { ensureUrlEndsWithSlash } from '@/util/utilities' import { PublicCommunityInfoLoggingView } from './logging/PublicCommunityInfoLogging.view' import { GetPublicKeyResult } from './model/GetPublicKeyResult' @@ -16,9 +17,7 @@ export class FederationClient { constructor(dbCom: DbFederatedCommunity) { this.dbCom = dbCom - this.endpoint = `${dbCom.endPoint.endsWith('/') ? dbCom.endPoint : dbCom.endPoint + '/'}${ - dbCom.apiVersion - }/` + this.endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion) this.client = new GraphQLClient(this.endpoint, { method: 'GET', jsonSerializer: { diff --git a/backend/src/federation/client/1_0/SendCoinsClient.ts b/backend/src/federation/client/1_0/SendCoinsClient.ts index bcf303584..03fefe70a 100644 --- a/backend/src/federation/client/1_0/SendCoinsClient.ts +++ b/backend/src/federation/client/1_0/SendCoinsClient.ts @@ -3,6 +3,7 @@ import { GraphQLClient } from 'graphql-request' import { LogError } from '@/server/LogError' import { backendLogger as logger } from '@/server/logger' +import { ensureUrlEndsWithSlash } from '@/util/utilities' import { SendCoinsArgsLoggingView } from './logging/SendCoinsArgsLogging.view' import { SendCoinsResultLoggingView } from './logging/SendCoinsResultLogging.view' @@ -20,9 +21,7 @@ export class SendCoinsClient { constructor(dbCom: DbFederatedCommunity) { this.dbCom = dbCom - this.endpoint = `${dbCom.endPoint.endsWith('/') ? dbCom.endPoint : dbCom.endPoint + '/'}${ - dbCom.apiVersion - }/` + this.endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion) this.client = new GraphQLClient(this.endpoint, { method: 'POST', jsonSerializer: { diff --git a/backend/src/federation/client/FederationClientFactory.ts b/backend/src/federation/client/FederationClientFactory.ts index fe2ff0dbd..6010fa5eb 100644 --- a/backend/src/federation/client/FederationClientFactory.ts +++ b/backend/src/federation/client/FederationClientFactory.ts @@ -5,6 +5,7 @@ import { FederationClient as V1_0_FederationClient } from '@/federation/client/1 // eslint-disable-next-line camelcase import { FederationClient as V1_1_FederationClient } from '@/federation/client/1_1/FederationClient' import { ApiVersionType } from '@/federation/enum/apiVersionType' +import { ensureUrlEndsWithSlash } from '@/util/utilities' // eslint-disable-next-line camelcase type FederationClient = V1_0_FederationClient | V1_1_FederationClient @@ -47,10 +48,7 @@ export class FederationClientFactory { const instance = FederationClientFactory.instanceArray.find( (instance) => instance.id === dbCom.id, ) - // TODO: found a way to prevent double code with FederationClient::constructor - const endpoint = `${dbCom.endPoint.endsWith('/') ? dbCom.endPoint : dbCom.endPoint + '/'}${ - dbCom.apiVersion - }/` + const endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion) // check if endpoint is still the same and not changed meanwhile if (instance && instance.client.getEndpoint() === endpoint) { return instance.client diff --git a/backend/src/graphql/model/FederatedCommunity.ts b/backend/src/graphql/model/FederatedCommunity.ts index fb30b0292..01a3996ce 100644 --- a/backend/src/graphql/model/FederatedCommunity.ts +++ b/backend/src/graphql/model/FederatedCommunity.ts @@ -1,6 +1,8 @@ import { FederatedCommunity as DbFederatedCommunity } from '@entity/FederatedCommunity' import { ObjectType, Field, Int } from 'type-graphql' +import { ensureUrlEndsWithSlash } from '@/util/utilities' + @ObjectType() export class FederatedCommunity { constructor(dbCom: DbFederatedCommunity) { @@ -8,7 +10,7 @@ export class FederatedCommunity { this.foreign = dbCom.foreign this.publicKey = dbCom.publicKey.toString('hex') this.apiVersion = dbCom.apiVersion - this.endPoint = dbCom.endPoint.endsWith('/') ? dbCom.endPoint : dbCom.endPoint + '/' + this.endPoint = ensureUrlEndsWithSlash(dbCom.endPoint) this.lastAnnouncedAt = dbCom.lastAnnouncedAt this.verifiedAt = dbCom.verifiedAt this.lastErrorAt = dbCom.lastErrorAt diff --git a/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts b/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts index 3f1677244..ef3c199c9 100644 --- a/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts +++ b/backend/src/graphql/resolver/util/authenticateGmsUserPlayground.ts @@ -4,15 +4,14 @@ import { verifyAuthToken } from '@/apis/gms/GmsClient' import { CONFIG } from '@/config' import { GmsUserAuthenticationResult } from '@/graphql/model/GmsUserAuthenticationResult' import { backendLogger as logger } from '@/server/logger' +import { ensureUrlEndsWithSlash } from '@/util/utilities' export async function authenticateGmsUserPlayground( token: string, dbUser: DbUser, ): Promise { const result = new GmsUserAuthenticationResult() - const dashboardUrl = CONFIG.GMS_DASHBOARD_URL.endsWith('/') - ? CONFIG.GMS_DASHBOARD_URL - : CONFIG.GMS_DASHBOARD_URL.concat('/') + const dashboardUrl = ensureUrlEndsWithSlash(CONFIG.GMS_DASHBOARD_URL) result.url = dashboardUrl.concat('playground') result.token = await verifyAuthToken(dbUser.communityUuid, token) From ad182c2948436643955f768be112f977ba5b8850 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Thu, 11 Apr 2024 16:54:31 +0200 Subject: [PATCH 15/17] correct refactoring --- backend/src/federation/client/1_0/AuthenticationClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/federation/client/1_0/AuthenticationClient.ts b/backend/src/federation/client/1_0/AuthenticationClient.ts index 6ee69d00d..c1d921823 100644 --- a/backend/src/federation/client/1_0/AuthenticationClient.ts +++ b/backend/src/federation/client/1_0/AuthenticationClient.ts @@ -14,7 +14,7 @@ export class AuthenticationClient { constructor(dbCom: DbFederatedCommunity) { this.dbCom = dbCom - this.endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion) + this.endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion).concat('/') this.client = new GraphQLClient(this.endpoint, { method: 'POST', jsonSerializer: { From fdc5850e8ea8515bef486376607a605141b190ef Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Thu, 11 Apr 2024 16:56:42 +0200 Subject: [PATCH 16/17] correct refactoring --- backend/src/federation/client/1_0/FederationClient.ts | 2 +- backend/src/federation/client/1_0/SendCoinsClient.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/federation/client/1_0/FederationClient.ts b/backend/src/federation/client/1_0/FederationClient.ts index 4612e6d62..0c2b4101b 100644 --- a/backend/src/federation/client/1_0/FederationClient.ts +++ b/backend/src/federation/client/1_0/FederationClient.ts @@ -17,7 +17,7 @@ export class FederationClient { constructor(dbCom: DbFederatedCommunity) { this.dbCom = dbCom - this.endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion) + this.endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion).concat('/') this.client = new GraphQLClient(this.endpoint, { method: 'GET', jsonSerializer: { diff --git a/backend/src/federation/client/1_0/SendCoinsClient.ts b/backend/src/federation/client/1_0/SendCoinsClient.ts index 03fefe70a..2c3fcce4c 100644 --- a/backend/src/federation/client/1_0/SendCoinsClient.ts +++ b/backend/src/federation/client/1_0/SendCoinsClient.ts @@ -21,7 +21,7 @@ export class SendCoinsClient { constructor(dbCom: DbFederatedCommunity) { this.dbCom = dbCom - this.endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion) + this.endpoint = ensureUrlEndsWithSlash(dbCom.endPoint).concat(dbCom.apiVersion).concat('/') this.client = new GraphQLClient(this.endpoint, { method: 'POST', jsonSerializer: { From fcd02b6a9b572a5bd3ff4564a7edb2ba9fd6b201 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Fri, 12 Apr 2024 19:43:36 +0200 Subject: [PATCH 17/17] add humhub switch and name format, refactor and reuse gms code --- backend/src/config/index.ts | 2 +- .../src/graphql/arg/UpdateUserInfosArgs.ts | 8 + backend/src/graphql/model/User.ts | 8 + .../src/graphql/resolver/UserResolver.test.ts | 2 + backend/src/graphql/resolver/UserResolver.ts | 12 +- backend/src/util/communityUser.ts | 2 + .../User.ts | 176 ++++++++++++++++++ database/entity/User.ts | 2 +- .../0084-introduce_humhub_registration.ts | 16 ++ deployment/bare_metal/.env.dist | 3 + dht-node/src/config/index.ts | 2 +- federation/src/config/index.ts | 2 +- frontend/.env.dist | 1 + frontend/.env.template | 3 +- .../components/UserSettings/UserGMSSwitch.vue | 45 ----- ...ormat.spec.js => UserNamingFormat.spec.js} | 17 +- ...SNamingFormat.vue => UserNamingFormat.vue} | 27 +-- .../UserSettings/UserSettingsSwitch.vue | 50 +++++ frontend/src/config/index.js | 1 + frontend/src/graphql/mutations.js | 6 + frontend/src/locales/de.json | 11 ++ frontend/src/locales/en.json | 11 ++ frontend/src/pages/Settings.vue | 125 ++++++++++--- frontend/src/store/store.js | 12 ++ frontend/src/store/store.test.js | 78 ++++++-- 25 files changed, 503 insertions(+), 119 deletions(-) create mode 100644 database/entity/0084-introduce_humhub_registration/User.ts create mode 100644 database/migrations/0084-introduce_humhub_registration.ts delete mode 100644 frontend/src/components/UserSettings/UserGMSSwitch.vue rename frontend/src/components/UserSettings/{UserGMSNamingFormat.spec.js => UserNamingFormat.spec.js} (79%) rename frontend/src/components/UserSettings/{UserGMSNamingFormat.vue => UserNamingFormat.vue} (77%) create mode 100644 frontend/src/components/UserSettings/UserSettingsSwitch.vue diff --git a/backend/src/config/index.ts b/backend/src/config/index.ts index dd35d180e..2815db440 100644 --- a/backend/src/config/index.ts +++ b/backend/src/config/index.ts @@ -12,7 +12,7 @@ Decimal.set({ }) const constants = { - DB_VERSION: '0083-join_community_federated_communities', + DB_VERSION: '0084-introduce_humhub_registration', DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info diff --git a/backend/src/graphql/arg/UpdateUserInfosArgs.ts b/backend/src/graphql/arg/UpdateUserInfosArgs.ts index a6c80cddd..d3e3dc744 100644 --- a/backend/src/graphql/arg/UpdateUserInfosArgs.ts +++ b/backend/src/graphql/arg/UpdateUserInfosArgs.ts @@ -46,6 +46,10 @@ export class UpdateUserInfosArgs { @IsBoolean() hideAmountGDT?: boolean + @Field({ nullable: true }) + @IsBoolean() + humhubAllowed?: boolean + @Field({ nullable: true }) @IsBoolean() gmsAllowed?: boolean @@ -54,6 +58,10 @@ export class UpdateUserInfosArgs { @IsEnum(GmsPublishNameType) gmsPublishName?: GmsPublishNameType | null + @Field(() => GmsPublishNameType, { nullable: true }) + @IsEnum(GmsPublishNameType) + humhubPublishName?: GmsPublishNameType | null + @Field(() => Location, { nullable: true }) @isValidLocation() gmsLocation?: Location | null diff --git a/backend/src/graphql/model/User.ts b/backend/src/graphql/model/User.ts index 166367fd1..a6a5ad199 100644 --- a/backend/src/graphql/model/User.ts +++ b/backend/src/graphql/model/User.ts @@ -32,8 +32,10 @@ export class User { this.hasElopage = null this.hideAmountGDD = user.hideAmountGDD this.hideAmountGDT = user.hideAmountGDT + this.humhubAllowed = user.humhubAllowed this.gmsAllowed = user.gmsAllowed this.gmsPublishName = user.gmsPublishName + this.humhubPublishName = user.humhubPublishName this.gmsPublishLocation = user.gmsPublishLocation } } @@ -80,12 +82,18 @@ export class User { @Field(() => Boolean) hideAmountGDT: boolean + @Field(() => Boolean) + humhubAllowed: boolean + @Field(() => Boolean) gmsAllowed: boolean @Field(() => GmsPublishNameType, { nullable: true }) gmsPublishName: GmsPublishNameType | null + @Field(() => GmsPublishNameType, { nullable: true }) + humhubPublishName: GmsPublishNameType | null + @Field(() => GmsPublishLocationType, { nullable: true }) gmsPublishLocation: GmsPublishLocationType | null diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index e7c873fc4..4fdf387b7 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -183,7 +183,9 @@ describe('UserResolver', () => { communityUuid: homeCom.communityUuid, foreign: false, gmsAllowed: true, + humhubAllowed: false, gmsPublishName: 0, + humhubPublishName: 0, gmsPublishLocation: 2, location: null, gmsRegistered: false, diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index 7c11776df..436c0aa83 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -394,8 +394,8 @@ export class UserResolver { logger.addContext('user', 'unknown') logger.info(`forgotPassword(${email})...`) email = email.trim().toLowerCase() - const user = await findUserByEmail(email).catch(() => { - logger.warn(`fail on find UserContact per ${email}`) + const user = await findUserByEmail(email).catch((error) => { + logger.warn(`fail on find UserContact per ${email} because: ${error}`) }) if (!user || user.deletedAt) { @@ -559,8 +559,10 @@ export class UserResolver { passwordNew, hideAmountGDD, hideAmountGDT, + humhubAllowed, gmsAllowed, gmsPublishName, + humhubPublishName, gmsLocation, gmsPublishLocation, } = updateUserInfosArgs @@ -617,12 +619,18 @@ export class UserResolver { if (hideAmountGDT !== undefined) { user.hideAmountGDT = hideAmountGDT } + if (humhubAllowed !== undefined) { + user.humhubAllowed = humhubAllowed + } if (gmsAllowed !== undefined) { user.gmsAllowed = gmsAllowed } if (gmsPublishName !== null && gmsPublishName !== undefined) { user.gmsPublishName = gmsPublishName } + if (humhubPublishName !== null && humhubPublishName !== undefined) { + user.humhubPublishName = humhubPublishName + } if (gmsLocation) { user.location = Location2Point(gmsLocation) } diff --git a/backend/src/util/communityUser.ts b/backend/src/util/communityUser.ts index 732c585d0..45a142ce8 100644 --- a/backend/src/util/communityUser.ts +++ b/backend/src/util/communityUser.ts @@ -52,7 +52,9 @@ const communityDbUser: dbUser = { communityUuid: '55555555-4444-4333-2222-11111111', community: null, gmsPublishName: 0, + humhubPublishName: 0, gmsAllowed: false, + humhubAllowed: false, location: null, gmsPublishLocation: 2, gmsRegistered: false, diff --git a/database/entity/0084-introduce_humhub_registration/User.ts b/database/entity/0084-introduce_humhub_registration/User.ts new file mode 100644 index 000000000..a375f6748 --- /dev/null +++ b/database/entity/0084-introduce_humhub_registration/User.ts @@ -0,0 +1,176 @@ +import { + BaseEntity, + Entity, + PrimaryGeneratedColumn, + Column, + DeleteDateColumn, + OneToMany, + JoinColumn, + OneToOne, + Geometry, + ManyToOne, +} from 'typeorm' +import { Contribution } from '../Contribution' +import { ContributionMessage } from '../ContributionMessage' +import { UserContact } from '../UserContact' +import { UserRole } from '../UserRole' +import { GeometryTransformer } from '../../src/typeorm/GeometryTransformer' +import { Community } from '../Community' + +@Entity('users', { engine: 'InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci' }) +export class User extends BaseEntity { + @PrimaryGeneratedColumn('increment', { unsigned: true }) + id: number + + @Column({ type: 'bool', default: false }) + foreign: boolean + + @Column({ + name: 'gradido_id', + length: 36, + nullable: false, + collation: 'utf8mb4_unicode_ci', + }) + gradidoID: string + + @Column({ + name: 'community_uuid', + type: 'char', + length: 36, + nullable: true, + collation: 'utf8mb4_unicode_ci', + }) + communityUuid: string + + @ManyToOne(() => Community, (community) => community.users) + @JoinColumn({ name: 'community_uuid', referencedColumnName: 'communityUuid' }) + community: Community | null + + @Column({ + name: 'alias', + length: 20, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + alias: string + + @OneToOne(() => UserContact, (emailContact: UserContact) => emailContact.user) + @JoinColumn({ name: 'email_id' }) + emailContact: UserContact + + @Column({ name: 'email_id', type: 'int', unsigned: true, nullable: true, default: null }) + emailId: number | null + + @Column({ + name: 'first_name', + length: 255, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + firstName: string + + @Column({ + name: 'last_name', + length: 255, + nullable: true, + default: null, + collation: 'utf8mb4_unicode_ci', + }) + lastName: string + + @Column({ name: 'gms_publish_name', type: 'int', unsigned: true, nullable: false, default: 0 }) + gmsPublishName: number + + @Column({ name: 'humhub_publish_name', type: 'int', unsigned: true, nullable: false, default: 0 }) + humhubPublishName: number + + @Column({ name: 'created_at', default: () => 'CURRENT_TIMESTAMP(3)', nullable: false }) + createdAt: Date + + @DeleteDateColumn({ name: 'deleted_at', nullable: true }) + deletedAt: Date | null + + @Column({ type: 'bigint', default: 0, unsigned: true }) + password: BigInt + + @Column({ + name: 'password_encryption_type', + type: 'int', + unsigned: true, + nullable: false, + default: 0, + }) + passwordEncryptionType: number + + @Column({ length: 4, default: 'de', collation: 'utf8mb4_unicode_ci', nullable: false }) + language: string + + @Column({ type: 'bool', default: false }) + hideAmountGDD: boolean + + @Column({ type: 'bool', default: false }) + hideAmountGDT: boolean + + @OneToMany(() => UserRole, (userRole) => userRole.user) + @JoinColumn({ name: 'user_id' }) + userRoles: UserRole[] + + @Column({ name: 'referrer_id', type: 'int', unsigned: true, nullable: true, default: null }) + referrerId?: number | null + + @Column({ + name: 'contribution_link_id', + type: 'int', + unsigned: true, + nullable: true, + default: null, + }) + contributionLinkId?: number | null + + @Column({ name: 'publisher_id', default: 0 }) + publisherId: number + + @Column({ name: 'gms_allowed', type: 'bool', default: true }) + gmsAllowed: boolean + + @Column({ + name: 'location', + type: 'geometry', + default: null, + nullable: true, + transformer: GeometryTransformer, + }) + location: Geometry | null + + @Column({ + name: 'gms_publish_location', + type: 'int', + unsigned: true, + nullable: false, + default: 2, + }) + gmsPublishLocation: number + + @Column({ name: 'gms_registered', type: 'bool', default: false }) + gmsRegistered: boolean + + @Column({ name: 'gms_registered_at', type: 'datetime', default: null, nullable: true }) + gmsRegisteredAt: Date | null + + @Column({ name: 'humhub_allowed', type: 'bool', default: false }) + humhubAllowed: boolean + + @OneToMany(() => Contribution, (contribution) => contribution.user) + @JoinColumn({ name: 'user_id' }) + contributions?: Contribution[] + + @OneToMany(() => ContributionMessage, (message) => message.user) + @JoinColumn({ name: 'user_id' }) + messages?: ContributionMessage[] + + @OneToMany(() => UserContact, (userContact: UserContact) => userContact.user) + @JoinColumn({ name: 'user_id' }) + userContacts?: UserContact[] +} diff --git a/database/entity/User.ts b/database/entity/User.ts index e3f15113d..993d983ef 100644 --- a/database/entity/User.ts +++ b/database/entity/User.ts @@ -1 +1 @@ -export { User } from './0082-introduce_gms_registration/User' +export { User } from './0084-introduce_humhub_registration/User' diff --git a/database/migrations/0084-introduce_humhub_registration.ts b/database/migrations/0084-introduce_humhub_registration.ts new file mode 100644 index 000000000..858283602 --- /dev/null +++ b/database/migrations/0084-introduce_humhub_registration.ts @@ -0,0 +1,16 @@ +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn( + 'ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `humhub_allowed` tinyint(1) NOT NULL DEFAULT 0 AFTER `gms_registered_at`;', + ) + await queryFn( + 'ALTER TABLE `users` ADD COLUMN IF NOT EXISTS `humhub_publish_name` int unsigned NOT NULL DEFAULT 0 AFTER `gms_publish_name`;', + ) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + await queryFn('ALTER TABLE `users` DROP COLUMN IF EXISTS `humhub_allowed`;') + await queryFn('ALTER TABLE `users` DROP COLUMN IF EXISTS `humhub_publish_name`;') +} diff --git a/deployment/bare_metal/.env.dist b/deployment/bare_metal/.env.dist index 3da4bd319..c3c7112d7 100644 --- a/deployment/bare_metal/.env.dist +++ b/deployment/bare_metal/.env.dist @@ -124,3 +124,6 @@ GMS_ACTIVE=false # Coordinates of Illuminz test instance #GMS_URL=http://54.176.169.179:3071 GMS_URL=http://localhost:4044/ + +# HUMHUB +HUMHUB_ACTIVE=false \ No newline at end of file diff --git a/dht-node/src/config/index.ts b/dht-node/src/config/index.ts index 4e66aa5f9..f557eee83 100644 --- a/dht-node/src/config/index.ts +++ b/dht-node/src/config/index.ts @@ -4,7 +4,7 @@ import dotenv from 'dotenv' dotenv.config() const constants = { - DB_VERSION: '0083-join_community_federated_communities', + DB_VERSION: '0084-introduce_humhub_registration', LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info LOG_LEVEL: process.env.LOG_LEVEL ?? 'info', diff --git a/federation/src/config/index.ts b/federation/src/config/index.ts index f8992a360..26b727841 100644 --- a/federation/src/config/index.ts +++ b/federation/src/config/index.ts @@ -10,7 +10,7 @@ Decimal.set({ }) const constants = { - DB_VERSION: '0083-join_community_federated_communities', + DB_VERSION: '0084-introduce_humhub_registration', DECAY_START_TIME: new Date('2021-05-13 17:46:31-0000'), // GMT+0 LOG4JS_CONFIG: 'log4js-config.json', // default log level on production should be info diff --git a/frontend/.env.dist b/frontend/.env.dist index f680d9a50..f11a70873 100644 --- a/frontend/.env.dist +++ b/frontend/.env.dist @@ -23,3 +23,4 @@ META_KEYWORDS_EN="Basic Income, Currency, Gratitude, Gift Economy, Natural Econo META_AUTHOR="Bernd Hückstädt - Gradido-Akademie" GMS_ACTIVE=false +HUMHUB_ACTIVE=false diff --git a/frontend/.env.template b/frontend/.env.template index c121545da..40d0e7ee1 100644 --- a/frontend/.env.template +++ b/frontend/.env.template @@ -25,4 +25,5 @@ META_KEYWORDS_DE=$META_KEYWORDS_DE META_KEYWORDS_EN=$META_KEYWORDS_EN META_AUTHOR=$META_AUTHOR -GMS_ACTIVE=$GMS_ACTIVE \ No newline at end of file +GMS_ACTIVE=$GMS_ACTIVE +HUMHUB_ACTIVE=$HUMHUB_ACTIVE \ No newline at end of file diff --git a/frontend/src/components/UserSettings/UserGMSSwitch.vue b/frontend/src/components/UserSettings/UserGMSSwitch.vue deleted file mode 100644 index 355beeff2..000000000 --- a/frontend/src/components/UserSettings/UserGMSSwitch.vue +++ /dev/null @@ -1,45 +0,0 @@ - - diff --git a/frontend/src/components/UserSettings/UserGMSNamingFormat.spec.js b/frontend/src/components/UserSettings/UserNamingFormat.spec.js similarity index 79% rename from frontend/src/components/UserSettings/UserGMSNamingFormat.spec.js rename to frontend/src/components/UserSettings/UserNamingFormat.spec.js index 3dbbfdb2c..f07f5e3f2 100644 --- a/frontend/src/components/UserSettings/UserGMSNamingFormat.spec.js +++ b/frontend/src/components/UserSettings/UserNamingFormat.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils' -import UserGMSNamingFormat from './UserGMSNamingFormat.vue' +import UserNamingFormat from './UserNamingFormat.vue' import { toastErrorSpy } from '@test/testSetup' const mockAPIcall = jest.fn() @@ -8,10 +8,10 @@ const storeCommitMock = jest.fn() const localVue = global.localVue -describe('UserGMSNamingFormat', () => { +describe('UserNamingFormat', () => { let wrapper beforeEach(() => { - wrapper = mount(UserGMSNamingFormat, { + wrapper = mount(UserNamingFormat, { mocks: { $t: (key) => key, // Mocking the translation function $store: { @@ -27,6 +27,9 @@ describe('UserGMSNamingFormat', () => { localVue, propsData: { selectedOption: 'GMS_PUBLISH_NAME_ALIAS_OR_INITALS', + initialValue: 'GMS_PUBLISH_NAME_ALIAS_OR_INITALS', + attrName: 'gmsPublishName', + successMessage: 'success message', }, }) }) @@ -53,16 +56,16 @@ describe('UserGMSNamingFormat', () => { const dropdownItem = wrapper.findAll('.dropdown-item').at(3) // Click the fourth item await dropdownItem.trigger('click') - expect(wrapper.emitted().gmsPublishName).toBeTruthy() - expect(wrapper.emitted().gmsPublishName.length).toBe(1) - expect(wrapper.emitted().gmsPublishName[0]).toEqual(['GMS_PUBLISH_NAME_FIRST_INITIAL']) + expect(wrapper.emitted().valueChanged).toBeTruthy() + expect(wrapper.emitted().valueChanged.length).toBe(1) + expect(wrapper.emitted().valueChanged[0]).toEqual(['GMS_PUBLISH_NAME_FIRST_INITIAL']) }) it('does not update when clicking on already selected option', async () => { const dropdownItem = wrapper.findAll('.dropdown-item').at(0) // Click the first item (which is already selected) await dropdownItem.trigger('click') - expect(wrapper.emitted().gmsPublishName).toBeFalsy() + expect(wrapper.emitted().valueChanged).toBeFalsy() }) describe('update with error', () => { diff --git a/frontend/src/components/UserSettings/UserGMSNamingFormat.vue b/frontend/src/components/UserSettings/UserNamingFormat.vue similarity index 77% rename from frontend/src/components/UserSettings/UserGMSNamingFormat.vue rename to frontend/src/components/UserSettings/UserNamingFormat.vue index 29b4cd384..510541219 100644 --- a/frontend/src/components/UserSettings/UserGMSNamingFormat.vue +++ b/frontend/src/components/UserSettings/UserNamingFormat.vue @@ -1,5 +1,5 @@ diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index e9eab2dd7..e574aa008 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -38,9 +38,15 @@ export const mutations = { gmsAllowed: (state, gmsAllowed) => { state.gmsAllowed = gmsAllowed }, + humhubAllowed: (state, humhubAllowed) => { + state.humhubAllowed = humhubAllowed + }, gmsPublishName: (state, gmsPublishName) => { state.gmsPublishName = gmsPublishName }, + humhubPublishName: (state, humhubPublishName) => { + state.humhubPublishName = humhubPublishName + }, gmsPublishLocation: (state, gmsPublishLocation) => { state.gmsPublishLocation = gmsPublishLocation }, @@ -81,7 +87,9 @@ export const actions = { commit('lastName', data.lastName) commit('newsletterState', data.klickTipp.newsletterState) commit('gmsAllowed', data.gmsAllowed) + commit('humhubAllowed', data.humhubAllowed) commit('gmsPublishName', data.gmsPublishName) + commit('humhubPublishName', data.humhubPublishName) commit('gmsPublishLocation', data.gmsPublishLocation) commit('hasElopage', data.hasElopage) commit('publisherId', data.publisherId) @@ -98,7 +106,9 @@ export const actions = { commit('lastName', '') commit('newsletterState', null) commit('gmsAllowed', null) + commit('humhubAllowed', null) commit('gmsPublishName', null) + commit('humhubPublishName', null) commit('gmsPublishLocation', null) commit('hasElopage', false) commit('publisherId', null) @@ -133,7 +143,9 @@ try { roles: [], newsletterState: null, gmsAllowed: null, + humhubAllowed: null, gmsPublishName: null, + humhubPublishName: null, gmsPublishLocation: null, hasElopage: false, publisherId: null, diff --git a/frontend/src/store/store.test.js b/frontend/src/store/store.test.js index 75ab308fd..6d06a3724 100644 --- a/frontend/src/store/store.test.js +++ b/frontend/src/store/store.test.js @@ -29,7 +29,9 @@ const { username, newsletterState, gmsAllowed, + humhubAllowed, gmsPublishName, + humhubPublishName, gmsPublishLocation, publisherId, roles, @@ -133,6 +135,14 @@ describe('Vuex store', () => { }) }) + describe('humhubAllowed', () => { + it('sets the state of humhubAllowed', () => { + const state = { humhubAllowed: null } + humhubAllowed(state, true) + expect(state.humhubAllowed).toEqual(true) + }) + }) + describe('gmsPublishName', () => { it('sets gmsPublishName', () => { const state = { gmsPublishName: null } @@ -141,6 +151,14 @@ describe('Vuex store', () => { }) }) + describe('humhubPublishName', () => { + it('sets humhubPublishName', () => { + const state = { humhubPublishName: null } + humhubPublishName(state, 'GMS_PUBLISH_NAME_INITIALS') + expect(state.humhubPublishName).toEqual('GMS_PUBLISH_NAME_INITIALS') + }) + }) + describe('gmsPublishLocation', () => { it('sets gmsPublishLocation', () => { const state = { gmsPublishLocation: null } @@ -218,7 +236,9 @@ describe('Vuex store', () => { newsletterState: true, }, gmsAllowed: true, + humhubAllowed: false, gmsPublishName: 'GMS_PUBLISH_NAME_FULL', + humhubPublishName: 'GMS_PUBLISH_NAME_FULL', gmsPublishLocation: 'GMS_LOCATION_TYPE_EXACT', hasElopage: false, publisherId: 1234, @@ -227,9 +247,9 @@ describe('Vuex store', () => { hideAmountGDT: true, } - it('calls fifteen commits', () => { + it('calls seventeen commits', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenCalledTimes(15) + expect(commit).toHaveBeenCalledTimes(17) }) it('commits gradidoID', () => { @@ -267,39 +287,49 @@ describe('Vuex store', () => { expect(commit).toHaveBeenNthCalledWith(7, 'gmsAllowed', true) }) + it('commits humhubAllowed', () => { + login({ commit, state }, commitedData) + expect(commit).toHaveBeenNthCalledWith(8, 'humhubAllowed', false) + }) + it('commits gmsPublishName', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(8, 'gmsPublishName', 'GMS_PUBLISH_NAME_FULL') + expect(commit).toHaveBeenNthCalledWith(9, 'gmsPublishName', 'GMS_PUBLISH_NAME_FULL') + }) + + it('commits humhubPublishName', () => { + login({ commit, state }, commitedData) + expect(commit).toHaveBeenNthCalledWith(10, 'humhubPublishName', 'GMS_PUBLISH_NAME_FULL') }) it('commits gmsPublishLocation', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(9, 'gmsPublishLocation', 'GMS_LOCATION_TYPE_EXACT') + expect(commit).toHaveBeenNthCalledWith(11, 'gmsPublishLocation', 'GMS_LOCATION_TYPE_EXACT') }) it('commits hasElopage', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(10, 'hasElopage', false) + expect(commit).toHaveBeenNthCalledWith(12, 'hasElopage', false) }) it('commits publisherId', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(11, 'publisherId', 1234) + expect(commit).toHaveBeenNthCalledWith(13, 'publisherId', 1234) }) it('commits roles', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(12, 'roles', ['admin']) + expect(commit).toHaveBeenNthCalledWith(14, 'roles', ['admin']) }) it('commits hideAmountGDD', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(13, 'hideAmountGDD', false) + expect(commit).toHaveBeenNthCalledWith(15, 'hideAmountGDD', false) }) it('commits hideAmountGDT', () => { login({ commit, state }, commitedData) - expect(commit).toHaveBeenNthCalledWith(14, 'hideAmountGDT', true) + expect(commit).toHaveBeenNthCalledWith(16, 'hideAmountGDT', true) }) }) @@ -307,9 +337,9 @@ describe('Vuex store', () => { const commit = jest.fn() const state = {} - it('calls seventeen commits', () => { + it('calls nineteen commits', () => { logout({ commit, state }) - expect(commit).toHaveBeenCalledTimes(17) + expect(commit).toHaveBeenCalledTimes(19) }) it('commits token', () => { @@ -347,44 +377,54 @@ describe('Vuex store', () => { expect(commit).toHaveBeenNthCalledWith(7, 'gmsAllowed', null) }) + it('commits humhubAllowed', () => { + logout({ commit, state }) + expect(commit).toHaveBeenNthCalledWith(8, 'humhubAllowed', null) + }) + it('commits gmsPublishName', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(8, 'gmsPublishName', null) + expect(commit).toHaveBeenNthCalledWith(9, 'gmsPublishName', null) + }) + + it('commits humhubPublishName', () => { + logout({ commit, state }) + expect(commit).toHaveBeenNthCalledWith(10, 'humhubPublishName', null) }) it('commits gmsPublishLocation', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(9, 'gmsPublishLocation', null) + expect(commit).toHaveBeenNthCalledWith(11, 'gmsPublishLocation', null) }) it('commits hasElopage', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(10, 'hasElopage', false) + expect(commit).toHaveBeenNthCalledWith(12, 'hasElopage', false) }) it('commits publisherId', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(11, 'publisherId', null) + expect(commit).toHaveBeenNthCalledWith(13, 'publisherId', null) }) it('commits roles', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(12, 'roles', null) + expect(commit).toHaveBeenNthCalledWith(14, 'roles', null) }) it('commits hideAmountGDD', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(13, 'hideAmountGDD', false) + expect(commit).toHaveBeenNthCalledWith(15, 'hideAmountGDD', false) }) it('commits hideAmountGDT', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(14, 'hideAmountGDT', true) + expect(commit).toHaveBeenNthCalledWith(16, 'hideAmountGDT', true) }) it('commits email', () => { logout({ commit, state }) - expect(commit).toHaveBeenNthCalledWith(15, 'email', '') + expect(commit).toHaveBeenNthCalledWith(17, 'email', '') }) // how to get this working?