[feat] create own function for showName
This commit is contained in:
parent
3f4f8a5fd4
commit
d8d89f0475
|
@ -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