[fix] show name by display mode setting
use showName from user plugin. No need to do it by itself.
This commit is contained in:
parent
6737bd5b45
commit
e7cd0320bf
|
@ -101,7 +101,7 @@ import { PERMISSIONS } from '../../../permissions';
|
||||||
import TransferInviteDialog from './TransferInviteDialog.vue';
|
import TransferInviteDialog from './TransferInviteDialog.vue';
|
||||||
import ServiceUserChip from './ServiceUserChip.vue';
|
import ServiceUserChip from './ServiceUserChip.vue';
|
||||||
import { UserAvatar } from '@flaschengeist/api/components';
|
import { UserAvatar } from '@flaschengeist/api/components';
|
||||||
import { DisplayNameMode } from '@flaschengeist/users';
|
import { showName } from '@flaschengeist/users';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'JobSlot',
|
name: 'JobSlot',
|
||||||
|
@ -132,27 +132,9 @@ export default defineComponent({
|
||||||
/* Stuff used for general display */
|
/* Stuff used for general display */
|
||||||
// Get displayname of user
|
// Get displayname of user
|
||||||
function userDisplay(id: string) {
|
function userDisplay(id: string) {
|
||||||
switch (userStore.userSettings.display_name) {
|
const user = userStore.findUser(id);
|
||||||
case DisplayNameMode.FIRSTNAME:
|
|
||||||
return userStore.findUser(id)?.firstname || id;
|
return user ? showName(user) : 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 (
|
|
||||||
`${<string>userStore.findUser(id)?.firstname} ${<string>(
|
|
||||||
userStore.findUser(id)?.lastname
|
|
||||||
)}` || id
|
|
||||||
);
|
|
||||||
case DisplayNameMode.LASTNAME_FIRSTNAME:
|
|
||||||
return (
|
|
||||||
`${<string>userStore.findUser(id)?.lastname}, ${<string>(
|
|
||||||
userStore.findUser(id)?.firstname
|
|
||||||
)}` || id
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return userStore.findUser(id)?.display_name || id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The name of the current job
|
// The name of the current job
|
||||||
|
|
|
@ -21,6 +21,7 @@ import { useUserStore } from '@flaschengeist/api';
|
||||||
import { PropType, computed, defineComponent, onBeforeMount, ref, watch } from 'vue';
|
import { PropType, computed, defineComponent, onBeforeMount, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { UserAvatar } from '@flaschengeist/api/components';
|
import { UserAvatar } from '@flaschengeist/api/components';
|
||||||
|
import { showName } from '@flaschengeist/users';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ServiceUserChip',
|
name: 'ServiceUserChip',
|
||||||
|
@ -50,7 +51,7 @@ export default defineComponent({
|
||||||
async () => (user.value = await userStore.getUser(props.modelValue.userid))
|
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(() =>
|
const serviceValue = computed(() =>
|
||||||
props.modelValue.value.toFixed(Number.isInteger(props.modelValue.value) ? 0 : 1)
|
props.modelValue.value.toFixed(Number.isInteger(props.modelValue.value) ? 0 : 1)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue