Compare commits
2 Commits
3f4f8a5fd4
...
f5a875007b
Author | SHA1 | Date |
---|---|---|
Tim Gröger | f5a875007b | |
Tim Gröger | d8d89f0475 |
|
@ -16,7 +16,7 @@
|
|||
<script lang="ts">
|
||||
import { computed, defineComponent, PropType, onBeforeMount, ref } from 'vue';
|
||||
import { useUserStore } from '@flaschengeist/api';
|
||||
import { DisplayNameMode } from '../models';
|
||||
import { showName } from '../utils';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'UserSelector',
|
||||
|
@ -68,20 +68,6 @@ export default defineComponent({
|
|||
get: () => props.modelValue,
|
||||
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 {
|
||||
selected,
|
||||
|
|
|
@ -29,3 +29,4 @@ const plugin: FG_Plugin.Plugin = {
|
|||
|
||||
export default plugin;
|
||||
export { DisplayNameMode };
|
||||
export * from './utils';
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import { DisplayNameMode } from '../models';
|
||||
import { useUserStore } from '@flaschengeist/api';
|
||||
|
||||
export function showName(user: FG.User) {
|
||||
const userStore = useUserStore();
|
||||
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}`;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue