mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 01:46:07 +00:00
change function and variable name
This commit is contained in:
parent
35f28dc060
commit
b894544a6b
@ -71,7 +71,8 @@ const defaultData = {
|
||||
const defaultUser = {
|
||||
firstName: 'Peter',
|
||||
lastName: 'Lustig',
|
||||
humhubUsername: 'peter.lustig',
|
||||
uniqueUsername: 'peter.lustig',
|
||||
publicName: 'PeLu',
|
||||
createdAt: new Date().toString(),
|
||||
emailContact: {
|
||||
email: 'peter.lustig@example.com',
|
||||
|
||||
@ -103,7 +103,7 @@ const humhubProfileLink = computed(() => {
|
||||
if (url.endsWith('/')) {
|
||||
url = url.slice(0, -1)
|
||||
}
|
||||
return `${url}/u/${props.contribution.user.uniqueUsername}`
|
||||
return `${url}/u/${props.contribution.user.userIdentifier}`
|
||||
})
|
||||
|
||||
const messages = ref([])
|
||||
|
||||
@ -14,7 +14,7 @@ query adminListContributions(
|
||||
}
|
||||
...UserCommonFields
|
||||
publicName
|
||||
uniqueUsername
|
||||
userIdentifier
|
||||
createdAt
|
||||
}
|
||||
amount
|
||||
|
||||
@ -8,7 +8,7 @@ import { PublishNameType } from '@/graphql/enum/PublishNameType'
|
||||
export class Account {
|
||||
public constructor(user: User) {
|
||||
const publishNameLogic = new PublishNameLogic(user)
|
||||
this.username = publishNameLogic.getUniqueUsername(user.humhubPublishName as PublishNameType)
|
||||
this.username = publishNameLogic.getUserIdentifier(user.humhubPublishName as PublishNameType)
|
||||
this.email = user.emailContact.email
|
||||
this.language = convertGradidoLanguageToHumhub(user.language)
|
||||
this.status = 1
|
||||
|
||||
@ -28,27 +28,27 @@ describe('test publish name logic', () => {
|
||||
user.gradidoID = gradidoUuid
|
||||
logic = new PublishNameLogic(user)
|
||||
})
|
||||
describe('test unique username', () => {
|
||||
describe('test user identifier ', () => {
|
||||
it('for alias or initials with alias set', () => {
|
||||
expect(logic.getUniqueUsername(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe('alias')
|
||||
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe('alias')
|
||||
})
|
||||
it('for alias or initials with empty alias', () => {
|
||||
user.alias = ''
|
||||
expect(logic.getUniqueUsername(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe(
|
||||
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_ALIAS_OR_INITALS)).toBe(
|
||||
gradidoUuid,
|
||||
)
|
||||
})
|
||||
it('for publish name initials', () => {
|
||||
expect(logic.getUniqueUsername(PublishNameType.PUBLISH_NAME_INITIALS)).toBe(gradidoUuid)
|
||||
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_INITIALS)).toBe(gradidoUuid)
|
||||
})
|
||||
it('for publish name first', () => {
|
||||
expect(logic.getUniqueUsername(PublishNameType.PUBLISH_NAME_FIRST)).toBe(gradidoUuid)
|
||||
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_FIRST)).toBe(gradidoUuid)
|
||||
})
|
||||
it('for publish name first initial', () => {
|
||||
expect(logic.getUniqueUsername(PublishNameType.PUBLISH_NAME_FIRST_INITIAL)).toBe(gradidoUuid)
|
||||
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_FIRST_INITIAL)).toBe(gradidoUuid)
|
||||
})
|
||||
it('for publish name full', () => {
|
||||
expect(logic.getUniqueUsername(PublishNameType.PUBLISH_NAME_FULL)).toBe(gradidoUuid)
|
||||
expect(logic.getUserIdentifier(PublishNameType.PUBLISH_NAME_FULL)).toBe(gradidoUuid)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ export class PublishNameLogic {
|
||||
* return alias
|
||||
* else return gradido id
|
||||
*/
|
||||
public getUniqueUsername(publishNameType: PublishNameType): string {
|
||||
public getUserIdentifier(publishNameType: PublishNameType): string {
|
||||
return this.isUsernameFromAlias(publishNameType)
|
||||
? this.filterOutInvalidChar(this.user.alias)
|
||||
: this.user.gradidoID
|
||||
|
||||
@ -28,7 +28,7 @@ export class User {
|
||||
const publishNameLogic = new PublishNameLogic(user)
|
||||
const publishNameType = user.humhubPublishName as PublishNameType
|
||||
this.publicName = publishNameLogic.getPublicName(publishNameType)
|
||||
this.uniqueUsername = publishNameLogic.getUniqueUsername(publishNameType)
|
||||
this.userIdentifier = publishNameLogic.getUserIdentifier(publishNameType)
|
||||
|
||||
if (user.emailContact) {
|
||||
this.emailChecked = user.emailContact.emailChecked
|
||||
@ -76,7 +76,7 @@ export class User {
|
||||
publicName: string | null
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
uniqueUsername: string | null
|
||||
userIdentifier: string | null
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
firstName: string | null
|
||||
|
||||
@ -833,7 +833,7 @@ export class UserResolver {
|
||||
throw new LogError('cannot create humhub client')
|
||||
}
|
||||
const userNameLogic = new PublishNameLogic(dbUser)
|
||||
const username = userNameLogic.getUniqueUsername(dbUser.humhubPublishName as PublishNameType)
|
||||
const username = userNameLogic.getUserIdentifier(dbUser.humhubPublishName as PublishNameType)
|
||||
let humhubUser = await humhubClient.userByUsername(username)
|
||||
if (!humhubUser) {
|
||||
humhubUser = await humhubClient.userByEmail(dbUser.emailContact.email)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user