UBERF-5337 (#4548)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-02-07 15:22:19 +06:00 committed by GitHub
parent 2d9eb8ec32
commit 169a83cd08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 21 additions and 3 deletions

View File

@ -21,7 +21,7 @@ import { boardId } from '@hcengineering/board'
import calendar, { calendarId } from '@hcengineering/calendar'
import { chunterId } from '@hcengineering/chunter'
import client, { clientId } from '@hcengineering/client'
import { contactId } from '@hcengineering/contact'
import contactPlugin, { contactId } from '@hcengineering/contact'
import gmail, { gmailId } from '@hcengineering/gmail'
import { hrId } from '@hcengineering/hr'
import { imageCropperId } from '@hcengineering/image-cropper'
@ -92,6 +92,7 @@ interface Config {
TITLE?: string
LANGUAGES?: string
DEFAULT_LANGUAGE?: string
LAST_NAME_FIRST?: string
}
const devConfig = process.env.CLIENT_TYPE === 'dev-production'
@ -157,6 +158,7 @@ export async function configurePlatform() {
setMetadata(uiPlugin.metadata.SearchPopup, view.component.ActionsPopup)
setMetadata(contactPlugin.metadata.LastNameFirst, config.LAST_NAME_FIRST === 'true' ?? false)
const languages = config.LANGUAGES ? (config.LANGUAGES as string).split(',').map((l) => l.trim()) : ['en', 'ru']
setMetadata(uiPlugin.metadata.Languages, languages)

View File

@ -15,7 +15,7 @@
//
import { Account, AttachedDoc, Class, Doc, Ref, Space, Timestamp, UXObject } from '@hcengineering/core'
import type { Asset, Plugin, Resource } from '@hcengineering/platform'
import type { Asset, Metadata, Plugin, Resource } from '@hcengineering/platform'
import { IntlString, plugin } from '@hcengineering/platform'
import { TemplateField, TemplateFieldCategory } from '@hcengineering/templates'
import type { AnyComponent, IconSize, ResolvedLocation } from '@hcengineering/ui'
@ -254,6 +254,9 @@ export const contactPlugin = plugin(contactId, {
app: {
Contacts: '' as Ref<Doc>
},
metadata: {
LastNameFirst: '' as Metadata<boolean>
},
string: {
PersonAlreadyExists: '' as IntlString,
Person: '' as IntlString,

View File

@ -18,6 +18,7 @@ import { IconSize, ColorDefinition } from '@hcengineering/ui'
import { MD5 } from 'crypto-js'
import { Channel, Contact, contactPlugin, Person } from '.'
import { AVATAR_COLORS, GravatarPlaceholderType } from './types'
import { getMetadata } from '@hcengineering/platform'
/**
* @public
@ -220,7 +221,9 @@ export function getLastName (name: string): string {
* @public
*/
export function formatName (name: string): string {
return getLastName(name) + ' ' + getFirstName(name)
return getMetadata(contactPlugin.metadata.LastNameFirst) === true
? getLastName(name) + ' ' + getFirstName(name)
: getFirstName(name) + ' ' + getLastName(name)
}
/**

View File

@ -21,6 +21,7 @@ import serverToken from '@hcengineering/server-token'
import { serverFactories } from '@hcengineering/server-ws'
import { start } from '.'
import serverNotification from '@hcengineering/server-notification'
import contactPlugin from '@hcengineering/contact'
const serverPort = parseInt(process.env.SERVER_PORT ?? '3333')
@ -91,10 +92,12 @@ if (accountsUrl === undefined) {
const sesUrl = process.env.SES_URL
const cursorMaxTime = process.env.SERVER_CURSOR_MAXTIMEMS
const lastNameFirst = process.env.LAST_NAME_FIRST === 'true' ?? false
setMetadata(serverCore.metadata.CursorMaxTimeMS, cursorMaxTime)
setMetadata(serverCore.metadata.FrontUrl, frontUrl)
setMetadata(serverToken.metadata.Secret, serverSecret)
setMetadata(serverNotification.metadata.SesUrl, sesUrl ?? '')
setMetadata(contactPlugin.metadata.LastNameFirst, lastNameFirst)
// eslint-disable-next-line @typescript-eslint/no-floating-promises
console.log(

View File

@ -151,6 +151,7 @@ export function start (
title?: string
languages: string
defaultLanguage: string
lastNameFirst?: string
},
port: number,
extraConfig?: Record<string, string>
@ -194,6 +195,7 @@ export function start (
TITLE: config.title,
LANGUAGES: config.languages,
DEFAULT_LANGUAGE: config.defaultLanguage,
LAST_NAME_FIRST: config.lastNameFirst,
...(extraConfig ?? {})
})
})

View File

@ -116,6 +116,8 @@ export function startFront (extraConfig?: Record<string, string>): void {
process.exit(1)
}
const lastNameFirst = process.env.LAST_NAME_FIRST
const title = process.env.TITLE
setMetadata(serverToken.metadata.Secret, serverSecret)
@ -128,6 +130,7 @@ export function startFront (extraConfig?: Record<string, string>): void {
uploadUrl,
modelVersion,
gmailUrl,
lastNameFirst,
telegramUrl,
rekoniUrl,
calendarUrl,

View File

@ -76,6 +76,7 @@ services:
- MINIO_ENDPOINT=minio
- MINIO_ACCESS_KEY=minioadmin
- MINIO_SECRET_KEY=minioadmin
- LAST_NAME_FIRST=true
transactor:
image: hardcoreeng/transactor
pull_policy: never
@ -100,6 +101,7 @@ services:
- REKONI_URL=http://rekoni:4005
- FRONT_URL=http://localhost:8083
- ACCOUNTS_URL=http://account:3003
- LAST_NAME_FIRST=true
collaborator:
image: hardcoreeng/collaborator
links: