Compare commits
No commits in common. "f5a875007b73b3d56144bb56adf850bf5fbe335f" and "3f4f8a5fd4a926b59f65cf9c1f20d3644e9964dc" have entirely different histories.
f5a875007b
...
3f4f8a5fd4
|
@ -16,7 +16,7 @@
|
|||
<script lang="ts">
|
||||
import { computed, defineComponent, PropType, onBeforeMount, ref } from 'vue';
|
||||
import { useUserStore } from '@flaschengeist/api';
|
||||
import { showName } from '../utils';
|
||||
import { DisplayNameMode } from '../models';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'UserSelector',
|
||||
|
@ -68,6 +68,20 @@ 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,4 +29,3 @@ const plugin: FG_Plugin.Plugin = {
|
|||
|
||||
export default plugin;
|
||||
export { DisplayNameMode };
|
||||
export * from './utils';
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
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