add all neccessary for showing humhub profile link in admin

This commit is contained in:
einhornimmond 2025-03-12 15:47:45 +01:00
parent 326829c7c7
commit c9816e3b74
10 changed files with 65 additions and 9 deletions

View File

@ -3,4 +3,5 @@ GRAPHQL_PATH=/graphql
WALLET_URL=http://localhost
WALLET_AUTH_PATH=/authenticate?token=
WALLET_LOGIN_PATH=/login
DEBUG_DISABLE_AUTH=false
DEBUG_DISABLE_AUTH=false
HUMHUB_ACTIVE=false

View File

@ -6,3 +6,6 @@ WALLET_AUTH_PATH=$WALLET_AUTH_PATH
WALLET_LOGIN_PATH=$WALLET_LOGIN_PATH
GRAPHQL_PATH=$GRAPHQL_PATH
DEBUG_DISABLE_AUTH=false
HUMHUB_ACTIVE=$HUMHUB_ACTIVE
HUMHUB_API_URL=$HUMHUB_API_URL

View File

@ -13,7 +13,20 @@
</BTooltip>
&nbsp;
{{ contribution.username }}
&nbsp; Humhub-Profil
&nbsp;
<span>
<a
v-if="humhubProfileLink"
id="humhub-username"
:href="humhubProfileLink"
target="_blank"
>
<i-arcticons-circles class="svg-icon" />
</a>
<BTooltip target="humhub-username" triggers="hover">
{{ $t('goTo.humhubProfile') }}
</BTooltip>
</span>
</BListGroupItem>
<BListGroupItem>
{{ $t('registered') }}: {{ new Date(contribution.createdAt).toLocaleString() }}
@ -45,10 +58,10 @@
<script setup>
import { ref, computed } from 'vue'
import { useQuery } from '@vue/apollo-composable'
import { adminListContributionMessages } from '../../graphql/adminListContributionMessages.js'
import { useAppToast } from '@/composables/useToast'
import { BListGroupItem } from 'bootstrap-vue-next'
import CONFIG from '@/config'
const props = defineProps({
contribution: {
@ -78,6 +91,16 @@ const mailtoLink = computed(() => {
const searchLink = computed(() => {
return `/user?search=${props.contribution.email}`
})
const humhubProfileLink = computed(() => {
if (CONFIG.HUMHUB_ACTIVE !== true) {
return undefined
}
let url = CONFIG.HUMHUB_API_URL
if (url.endsWith('/')) {
url = url.slice(0, -1)
}
return `${url}/u/${props.contribution.humhubUsername}`
})
const messages = ref([])

View File

@ -50,12 +50,17 @@ const endpoints = {
const debug = {
DEBUG_DISABLE_AUTH: process.env.DEBUG_DISABLE_AUTH === 'true' ?? false,
}
const humhub = {
HUMHUB_ACTIVE: process.env.HUMHUB_ACTIVE === 'true' || false,
HUMHUB_API_URL: process.env.HUMHUB_API_URL ?? COMMUNITY_URL + '/community/',
}
const CONFIG = {
...version,
...environment,
...endpoints,
...debug,
...humhub,
ADMIN_MODULE_URL,
COMMUNITY_URL,
}

View File

@ -5,6 +5,8 @@ const {
COMMUNITY_URL,
DEBUG,
GRAPHQL_URI,
HUMHUB_ACTIVE,
HUMHUB_API_URL,
NODE_ENV,
PRODUCTION,
} = require('gradido-config/build/src/commonSchema.js')
@ -17,9 +19,16 @@ module.exports = Joi.object({
COMMUNITY_URL,
DEBUG,
GRAPHQL_URI,
HUMHUB_ACTIVE,
// HUMHUB_API_URL,
NODE_ENV,
PRODUCTION,
HUMHUB_API_URL: Joi.string()
.uri({ scheme: ['http', 'https'] })
.when('HUMHUB_ACTIVE', { is: true, then: Joi.required(), otherwise: Joi.optional() })
.description('The API URL for HumHub integration'),
ADMIN_HOSTING: Joi.string()
.valid('nodejs', 'nginx')
.description('set to `nodejs` if admin is hosted by vite with a own nodejs instance')

View File

@ -28,6 +28,7 @@ export const adminListContributions = gql`
lastName
email
username
humhubUsername
amount
memo
createdAt

View File

@ -24,7 +24,6 @@ export default defineConfig(async ({ command }) => {
} else {
CONFIG.ADMIN_HOSTING = 'nginx'
}
// Check config
validate(schema, CONFIG)
// make sure that all urls used in browser have the same protocol to prevent mixed content errors
validate(browserUrls, [
@ -78,6 +77,8 @@ export default defineConfig(async ({ command }) => {
WALLET_AUTH_PATH: CONFIG.WALLET_AUTH_PATH ?? null,
WALLET_LOGIN_PATH: CONFIG.WALLET_LOGIN_URL ?? null, // null,
DEBUG_DISABLE_AUTH: CONFIG.DEBUG_DISABLE_AUTH ?? null, // null,
HUMHUB_ACTIVE: CONFIG.HUMHUB_ACTIVE ?? null, // null,
HUMHUB_API_URL: CONFIG.HUMHUB_API_URL ?? null, // null,
// CONFIG_VERSION: CONFIG.CONFIG_VERSION, // null,
}),
vitePluginGraphqlLoader(),

View File

@ -17,6 +17,7 @@ import {
GMS_ACTIVE,
GRAPHIQL,
HUMHUB_ACTIVE,
HUMHUB_API_URL,
LOG4JS_CONFIG,
LOGIN_APP_SECRET,
LOGIN_SERVER_KEY,
@ -44,6 +45,7 @@ export const schema = Joi.object({
GMS_ACTIVE,
GRAPHIQL,
HUMHUB_ACTIVE,
HUMHUB_API_URL,
LOG4JS_CONFIG,
LOGIN_APP_SECRET,
LOGIN_SERVER_KEY,
@ -281,11 +283,6 @@ export const schema = Joi.object({
.when('GMS_ACTIVE', { is: true, then: Joi.required(), otherwise: Joi.optional() })
.description('The secret postfix for the GMS webhook endpoint'),
HUMHUB_API_URL: Joi.string()
.uri({ scheme: ['http', 'https'] })
.when('HUMHUB_ACTIVE', { is: true, then: Joi.required(), otherwise: Joi.optional() })
.description('The API URL for HumHub integration'),
HUMHUB_JWT_KEY: Joi.string()
.min(1)
.when('HUMHUB_ACTIVE', {

View File

@ -3,6 +3,10 @@ import { User } from '@entity/User'
import { Decimal } from 'decimal.js-light'
import { ObjectType, Field, Int } from 'type-graphql'
import { PublishNameType } from '@enum/PublishNameType'
import { PublishNameLogic } from '@/data/PublishName.logic'
@ObjectType()
export class Contribution {
constructor(contribution: dbContribution, user?: User | null) {
@ -11,6 +15,10 @@ export class Contribution {
this.lastName = user?.lastName ?? null
this.email = user?.emailContact?.email ?? null
this.username = user?.alias ?? null
if (user) {
const publishNameLogic = new PublishNameLogic(user)
this.humhubUsername = publishNameLogic.getUsername(user.humhubPublishName as PublishNameType)
}
this.amount = contribution.amount
this.memo = contribution.memo
this.createdAt = contribution.createdAt
@ -45,6 +53,9 @@ export class Contribution {
@Field(() => String, { nullable: true })
username: string | null
@Field(() => String, { nullable: true })
humhubUsername: string | null
@Field(() => Decimal)
amount: Decimal

View File

@ -117,6 +117,11 @@ export const HUMHUB_ACTIVE = Joi.boolean()
.default(false)
.required()
export const HUMHUB_API_URL = Joi.string()
.uri({ scheme: ['http', 'https'] })
.when('HUMHUB_ACTIVE', { is: true, then: Joi.required(), otherwise: Joi.optional() })
.description('The API URL for HumHub integration')
export const LOG_LEVEL = Joi.string()
.valid('all', 'mark', 'trace', 'debug', 'info', 'warn', 'error', 'fatal', 'off')
.description('set log level')