mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
fientuneing
This commit is contained in:
parent
ac4723ecc5
commit
a869d147e2
@ -125,6 +125,7 @@ export class HumHubClient {
|
||||
* @param user for saving on humhub instance
|
||||
*/
|
||||
public async createUser(user: PostUser): Promise<void> {
|
||||
logger.info('create new humhub user', user)
|
||||
const options = await this.createRequestOptions()
|
||||
try {
|
||||
const response = await this.restClient.create('/api/v1/user', user, options)
|
||||
@ -147,6 +148,7 @@ export class HumHubClient {
|
||||
* @returns updated user object on success
|
||||
*/
|
||||
public async updateUser(user: PostUser, humhubUserId: number): Promise<GetUser | null> {
|
||||
logger.info('update humhub user', user)
|
||||
const options = await this.createRequestOptions()
|
||||
const response = await this.restClient.update<GetUser>(
|
||||
`/api/v1/user/${humhubUserId}`,
|
||||
@ -162,6 +164,7 @@ export class HumHubClient {
|
||||
}
|
||||
|
||||
public async deleteUser(humhubUserId: number): Promise<void> {
|
||||
logger.info('delete humhub user', { userId: humhubUserId })
|
||||
const options = await this.createRequestOptions()
|
||||
const response = await this.restClient.del(`/api/v1/user/${humhubUserId}`, options)
|
||||
if (response.statusCode === 400) {
|
||||
|
||||
@ -3,7 +3,6 @@ import { UserContact } from '@entity/UserContact'
|
||||
|
||||
import { HumHubClient } from '@/apis/humhub/HumHubClient'
|
||||
import { GetUser } from '@/apis/humhub/model/GetUser'
|
||||
import { ExecutedHumhubAction } from '@/apis/humhub/syncUser'
|
||||
import { UpdateUserInfosArgs } from '@/graphql/arg/UpdateUserInfosArgs'
|
||||
import { PublishNameType } from '@/graphql/enum/PublishNameType'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
@ -28,9 +27,6 @@ describe('syncHumhub', () => {
|
||||
jest.spyOn(HumHubClient, 'getInstance')
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
// humhubClientMockbAfterEach()
|
||||
})
|
||||
afterAll(() => {
|
||||
jest.resetAllMocks()
|
||||
})
|
||||
@ -39,7 +35,7 @@ describe('syncHumhub', () => {
|
||||
await syncHumhub(mockUpdateUserInfosArg, new User())
|
||||
expect(HumHubClient.getInstance).not.toBeCalled()
|
||||
// language logging from some other place
|
||||
expect(logger.debug).toBeCalledTimes(4)
|
||||
expect(logger.debug).toBeCalledTimes(5)
|
||||
expect(logger.info).toBeCalledTimes(0)
|
||||
})
|
||||
|
||||
@ -47,11 +43,11 @@ describe('syncHumhub', () => {
|
||||
mockUpdateUserInfosArg.firstName = 'New' // Relevant changes
|
||||
mockUser.firstName = 'New'
|
||||
await syncHumhub(mockUpdateUserInfosArg, mockUser)
|
||||
expect(logger.debug).toHaveBeenCalledTimes(7) // Four language logging calls, two debug calls in function, one for not syncing
|
||||
expect(logger.debug).toHaveBeenCalledTimes(8) // Four language logging calls, two debug calls in function, one for not syncing
|
||||
expect(logger.info).toHaveBeenLastCalledWith('finished sync user with humhub', {
|
||||
localId: mockUser.id,
|
||||
externId: mockHumHubUser.id,
|
||||
result: ExecutedHumhubAction.UPDATE,
|
||||
result: 'UPDATE',
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { User } from '@entity/User'
|
||||
|
||||
import { HumHubClient } from '@/apis/humhub/HumHubClient'
|
||||
import { GetUser } from '@/apis/humhub/model/GetUser'
|
||||
import { syncUser } from '@/apis/humhub/syncUser'
|
||||
import { ExecutedHumhubAction, syncUser } from '@/apis/humhub/syncUser'
|
||||
import { UpdateUserInfosArgs } from '@/graphql/arg/UpdateUserInfosArgs'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
@ -12,13 +12,14 @@ export async function syncHumhub(
|
||||
): Promise<void> {
|
||||
// check for humhub relevant changes
|
||||
if (
|
||||
!updateUserInfosArg.alias &&
|
||||
!updateUserInfosArg.firstName &&
|
||||
!updateUserInfosArg.lastName &&
|
||||
!updateUserInfosArg.humhubAllowed &&
|
||||
!updateUserInfosArg.humhubPublishName &&
|
||||
!updateUserInfosArg.language
|
||||
updateUserInfosArg.alias === undefined &&
|
||||
updateUserInfosArg.firstName === undefined &&
|
||||
updateUserInfosArg.lastName === undefined &&
|
||||
updateUserInfosArg.humhubAllowed === undefined &&
|
||||
updateUserInfosArg.humhubPublishName === undefined &&
|
||||
updateUserInfosArg.language === undefined
|
||||
) {
|
||||
logger.debug('no relevant changes')
|
||||
return
|
||||
}
|
||||
logger.debug('changed user-settings relevant for humhub-user update...')
|
||||
@ -37,6 +38,9 @@ export async function syncHumhub(
|
||||
logger.info('finished sync user with humhub', {
|
||||
localId: user.id,
|
||||
externId: humhubUser?.id,
|
||||
result,
|
||||
// for preventing this warning https://github.com/eslint-community/eslint-plugin-security/blob/main/docs/rules/detect-object-injection.md
|
||||
// and possible danger coming with it
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
result: ExecutedHumhubAction[result as ExecutedHumhubAction],
|
||||
})
|
||||
}
|
||||
|
||||
@ -58,7 +58,10 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
selectedOptionLabel() {
|
||||
return this.dropdownOptions.find((option) => option.value === this.selectedOption).label
|
||||
const selected = this.dropdownOptions.find((option) => option.value === this.selectedOption)
|
||||
.label
|
||||
return selected || this.$t('settings.publish-name.alias-or-initials')
|
||||
// return this.dropdownOptions.find((option) => option.value === this.selectedOption).label
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
test="BFormCheckbox"
|
||||
v-model="value"
|
||||
name="check-button"
|
||||
:disabled="disabled"
|
||||
switch
|
||||
@change="onChange"
|
||||
></b-form-checkbox>
|
||||
@ -19,6 +20,7 @@ export default {
|
||||
attrName: { type: String },
|
||||
enabledText: { type: String },
|
||||
disabledText: { type: String },
|
||||
disabled: { type: Boolean, default: false },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -27,6 +29,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async onChange() {
|
||||
if (this.isDisabled) return
|
||||
const variables = []
|
||||
variables[this.attrName] = this.value
|
||||
this.$apollo
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"GDD": "GDD",
|
||||
"GDT": "GDT",
|
||||
"GMS": {
|
||||
"title": "Geo Matching System GMS",
|
||||
"title": "Geo Matching System GMS (in Entwicklung)",
|
||||
"desc": "Finde Mitglieder aller Communities auf einer Landkarte."
|
||||
},
|
||||
"Humhub": {
|
||||
@ -316,8 +316,8 @@
|
||||
"label": "Positionsbestimmung",
|
||||
"button": "Klick mich!"
|
||||
},
|
||||
"location-format": "Positionstyp",
|
||||
"naming-format": "Namensformat im GMS",
|
||||
"location-format": "Position auf Karte anzeigen:",
|
||||
"naming-format": "Namen anzeigen:",
|
||||
"publish-location": {
|
||||
"exact": "Genaue Position",
|
||||
"approximate": "Ungefähre Position",
|
||||
@ -326,19 +326,17 @@
|
||||
},
|
||||
"publish-name": {
|
||||
"updated": "Namensformat für GMS aktualisiert"
|
||||
},
|
||||
"switch": "Erlaubnis Daten nach GMS zu exportieren."
|
||||
}
|
||||
},
|
||||
"hideAmountGDD": "Dein GDD Betrag ist versteckt.",
|
||||
"hideAmountGDT": "Dein GDT Betrag ist versteckt.",
|
||||
"humhub": {
|
||||
"disabled": "Daten werden nicht in die Gradido Community exportiert",
|
||||
"enabled": "Daten werden in die Gradido Community exportiert",
|
||||
"naming-format": "Namensformat in der Gradido Community",
|
||||
"naming-format": "Namen anzeigen:",
|
||||
"publish-name": {
|
||||
"updated": "Namensformat für die Gradido Community aktualisiert."
|
||||
},
|
||||
"switch": "Erlaubnis Daten in die Gradido Community zu exportieren."
|
||||
}
|
||||
},
|
||||
"info": "Transaktionen können nun per Benutzername oder E-Mail-Adresse getätigt werden.",
|
||||
"language": {
|
||||
@ -378,7 +376,7 @@
|
||||
"subtitle": "Wenn du dein Passwort vergessen hast, kannst du es hier zurücksetzen."
|
||||
},
|
||||
"publish-name": {
|
||||
"alias-or-initials": "Benutzername oder Initialen (Default)",
|
||||
"alias-or-initials": "Benutzername oder Initialen",
|
||||
"alias-or-initials-tooltip": "Benutzername, falls vorhanden, oder die Initialen von Vorname und Nachname",
|
||||
"first": "Vorname",
|
||||
"first-tooltip": "Nur der Vornamen",
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
"GDD": "GDD",
|
||||
"GDT": "GDT",
|
||||
"GMS": {
|
||||
"title": "Geo Matching System GMS",
|
||||
"title": "Geo Matching System GMS (in develop)",
|
||||
"desc": "Find members of all communities on a map."
|
||||
},
|
||||
"Humhub": {
|
||||
@ -316,8 +316,8 @@
|
||||
"label": "pinpoint location",
|
||||
"button": "click me!"
|
||||
},
|
||||
"location-format": "location type",
|
||||
"naming-format": "Format of name in GMS",
|
||||
"location-format": "Show position on map:",
|
||||
"naming-format": "Show Name:",
|
||||
"publish-location": {
|
||||
"exact": "exact position",
|
||||
"approximate": "approximate position",
|
||||
@ -326,19 +326,17 @@
|
||||
},
|
||||
"publish-name": {
|
||||
"updated": "format of name for GMS updated"
|
||||
},
|
||||
"switch": "Allow data export to GMS"
|
||||
}
|
||||
},
|
||||
"hideAmountGDD": "Your GDD amount is hidden.",
|
||||
"hideAmountGDT": "Your GDT amount is hidden.",
|
||||
"humhub": {
|
||||
"disabled": "Data not exported into the Gradido Community",
|
||||
"enabled": "Data exported into the Gradido Community",
|
||||
"naming-format": "Format of name in the Gradido Community",
|
||||
"naming-format": "Show Name:",
|
||||
"publish-name": {
|
||||
"updated": "Format of name for the Gradido Community updated."
|
||||
},
|
||||
"switch": "Allow data export into the Gradido Community."
|
||||
}
|
||||
},
|
||||
"info": "Transactions can now be made by username or email address.",
|
||||
"language": {
|
||||
|
||||
@ -82,26 +82,52 @@
|
||||
<div v-if="isCommunityService">
|
||||
<b-tab :title="$t('settings.community')">
|
||||
<div class="h2">{{ $t('settings.allow-community-services') }}</div>
|
||||
<div v-if="isGMS">
|
||||
<div class="h3">{{ $t('GMS.title') }}</div>
|
||||
<div class="h4">{{ $t('GMS.desc') }}</div>
|
||||
<b-row class="mb-3">
|
||||
<div v-if="isHumhub" class="mt-4">
|
||||
<b-row>
|
||||
<b-col cols="12" md="6" lg="6">
|
||||
{{ $t('settings.GMS.switch') }}
|
||||
<div class="text-small">
|
||||
{{ gmsAllowed ? $t('settings.GMS.enabled') : $t('settings.GMS.disabled') }}
|
||||
</div>
|
||||
<div class="h3">{{ $t('Humhub.title') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="12" md="6" lg="6" class="text-right">
|
||||
<user-settings-switch
|
||||
@valueChanged="humhubStateSwitch"
|
||||
:initialValue="$store.state.humhubAllowed"
|
||||
:attrName="'humhubAllowed'"
|
||||
:enabledText="$t('settings.humhub.enabled')"
|
||||
:disabledText="$t('settings.humhub.disabled')"
|
||||
/>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<div class="h4">{{ $t('Humhub.desc') }}</div>
|
||||
<b-row v-if="humhubAllowed" class="mt-4 humhub-publish-name-row">
|
||||
<b-col cols="12" md="6" lg="6">
|
||||
{{ $t('settings.humhub.naming-format') }}
|
||||
</b-col>
|
||||
<b-col cols="12" md="6" lg="6">
|
||||
<user-naming-format
|
||||
:initialValue="$store.state.humhubPublishName"
|
||||
:attrName="'humhubPublishName'"
|
||||
:successMessage="$t('settings.humhub.publish-name.updated')"
|
||||
/>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
<div v-if="isGMS">
|
||||
<b-row>
|
||||
<b-col cols="12" md="6" lg="6">
|
||||
<div class="h3 text-muted">{{ $t('GMS.title') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="12" md="6" lg="6" class="text-right">
|
||||
<user-settings-switch
|
||||
@valueChanged="gmsStateSwitch"
|
||||
:initialValue="$store.state.gmsAllowed"
|
||||
:attrName="'gmsAllowed'"
|
||||
:disabled="true"
|
||||
:enabledText="$t('settings.GMS.enabled')"
|
||||
:disabledText="$t('settings.GMS.disabled')"
|
||||
/>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<div class="h4 mb-3">{{ $t('GMS.desc') }}</div>
|
||||
<div v-if="gmsAllowed">
|
||||
<b-row class="mb-4">
|
||||
<b-col cols="12" md="6" lg="6">
|
||||
@ -133,41 +159,6 @@
|
||||
</b-row>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="isHumhub">
|
||||
<div class="h3">{{ $t('Humhub.title') }}</div>
|
||||
<div class="h4">{{ $t('Humhub.desc') }}</div>
|
||||
<b-row class="mb-3">
|
||||
<b-col cols="12" md="6" lg="6">
|
||||
{{ $t('settings.humhub.switch') }}
|
||||
<div class="text-small">
|
||||
{{
|
||||
humhubAllowed ? $t('settings.humhub.enabled') : $t('settings.humhub.disabled')
|
||||
}}
|
||||
</div>
|
||||
</b-col>
|
||||
<b-col cols="12" md="6" lg="6" class="text-right">
|
||||
<user-settings-switch
|
||||
@valueChanged="humhubStateSwitch"
|
||||
:initialValue="$store.state.humhubAllowed"
|
||||
:attrName="'humhubAllowed'"
|
||||
:enabledText="$t('settings.humhub.enabled')"
|
||||
:disabledText="$t('settings.humhub.disabled')"
|
||||
/>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row v-if="humhubAllowed" class="mb-4 humhub-publish-name-row">
|
||||
<b-col cols="12" md="6" lg="6">
|
||||
{{ $t('settings.humhub.naming-format') }}
|
||||
</b-col>
|
||||
<b-col cols="12" md="6" lg="6">
|
||||
<user-naming-format
|
||||
:initialValue="$store.state.humhubPublishName"
|
||||
:attrName="'humhubPublishName'"
|
||||
:successMessage="$t('settings.humhub.publish-name.updated')"
|
||||
/>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</b-tab>
|
||||
</div>
|
||||
</b-tabs>
|
||||
@ -292,7 +283,7 @@ export default {
|
||||
</script>
|
||||
<style>
|
||||
.humhub-publish-name-row {
|
||||
min-height: 200px;
|
||||
min-height: 210px;
|
||||
}
|
||||
.card-border-radius {
|
||||
border-radius: 0px 5px 5px 0px !important;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user