[fix] use showName in UserSelector to show name by display mode setting

This commit is contained in:
Tim Gröger 2024-10-11 08:09:22 +02:00
parent d8d89f0475
commit f5a875007b
1 changed files with 1 additions and 15 deletions

View File

@ -16,7 +16,7 @@
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, PropType, onBeforeMount, ref } from 'vue'; import { computed, defineComponent, PropType, onBeforeMount, ref } from 'vue';
import { useUserStore } from '@flaschengeist/api'; import { useUserStore } from '@flaschengeist/api';
import { DisplayNameMode } from '../models'; import { showName } from '../utils';
export default defineComponent({ export default defineComponent({
name: 'UserSelector', name: 'UserSelector',
@ -68,20 +68,6 @@ export default defineComponent({
get: () => props.modelValue, get: () => props.modelValue,
set: (value: FG.User | undefined) => (value ? emit('update:modelValue', value) : undefined), set: (value: FG.User | undefined) => (value ? emit('update:modelValue', value) : undefined),
}); });
function showName(user: FG.User) {
switch (userStore.userSettings.display_name) {
case DisplayNameMode.DISPLAYNAME:
return user.display_name;
case DisplayNameMode.FIRSTNAME:
return user.firstname;
case DisplayNameMode.LASTNAME:
return user.lastname;
case DisplayNameMode.FIRSTNAME_LASTNAME:
return `${user.firstname} ${user.lastname}`;
case DisplayNameMode.LASTNAME_FIRSTNAME:
return `${user.lastname}, ${user.firstname}`;
}
}
return { return {
selected, selected,