diff --git a/src/components/overview/slots/JobSlot.vue b/src/components/overview/slots/JobSlot.vue index 5853a80..dfda11f 100644 --- a/src/components/overview/slots/JobSlot.vue +++ b/src/components/overview/slots/JobSlot.vue @@ -101,7 +101,7 @@ import { PERMISSIONS } from '../../../permissions'; import TransferInviteDialog from './TransferInviteDialog.vue'; import ServiceUserChip from './ServiceUserChip.vue'; import { UserAvatar } from '@flaschengeist/api/components'; -import { DisplayNameMode } from '@flaschengeist/users'; +import { showName } from '@flaschengeist/users'; export default defineComponent({ name: 'JobSlot', @@ -132,27 +132,9 @@ export default defineComponent({ /* Stuff used for general display */ // Get displayname of user function userDisplay(id: string) { - switch (userStore.userSettings.display_name) { - case DisplayNameMode.FIRSTNAME: - return userStore.findUser(id)?.firstname || id; - case DisplayNameMode.LASTNAME: - return userStore.findUser(id)?.lastname || id; - case DisplayNameMode.DISPLAYNAME: - return userStore.findUser(id)?.display_name || id; - case DisplayNameMode.FIRSTNAME_LASTNAME: - return ( - `${userStore.findUser(id)?.firstname} ${( - userStore.findUser(id)?.lastname - )}` || id - ); - case DisplayNameMode.LASTNAME_FIRSTNAME: - return ( - `${userStore.findUser(id)?.lastname}, ${( - userStore.findUser(id)?.firstname - )}` || id - ); - } - return userStore.findUser(id)?.display_name || id; + const user = userStore.findUser(id); + + return user ? showName(user) : id; } // The name of the current job diff --git a/src/components/overview/slots/ServiceUserChip.vue b/src/components/overview/slots/ServiceUserChip.vue index 90929bd..264a624 100644 --- a/src/components/overview/slots/ServiceUserChip.vue +++ b/src/components/overview/slots/ServiceUserChip.vue @@ -21,6 +21,7 @@ import { useUserStore } from '@flaschengeist/api'; import { PropType, computed, defineComponent, onBeforeMount, ref, watch } from 'vue'; import { UserAvatar } from '@flaschengeist/api/components'; +import { showName } from '@flaschengeist/users'; export default defineComponent({ name: 'ServiceUserChip', @@ -50,7 +51,7 @@ export default defineComponent({ async () => (user.value = await userStore.getUser(props.modelValue.userid)) ); - const displayName = computed(() => user.value?.display_name || '...'); + const displayName = computed(() => (user.value ? showName(user.value) : '...')); const serviceValue = computed(() => props.modelValue.value.toFixed(Number.isInteger(props.modelValue.value) ? 0 : 1) );