summaryrefslogtreecommitdiff
path: root/packages/frontend/src/utility/get-user-name.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/utility/get-user-name.ts')
-rw-r--r--packages/frontend/src/utility/get-user-name.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/frontend/src/utility/get-user-name.ts b/packages/frontend/src/utility/get-user-name.ts
new file mode 100644
index 0000000000..56e91abba0
--- /dev/null
+++ b/packages/frontend/src/utility/get-user-name.ts
@@ -0,0 +1,8 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+export default function(user: { name?: string | null, username: string }): string {
+ return user.name === '' ? user.username : user.name ?? user.username;
+}