Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Allow passing username=“?” to indicate unknown name

天舟89cfc7ccca86
diff --git a/frontend/src/bbkit/BBAvatar.vue b/frontend/src/bbkit/BBAvatar.vue
index a417f32784..5c568b9015 100644
--- a/frontend/src/bbkit/BBAvatar.vue
+++ b/frontend/src/bbkit/BBAvatar.vue
@@ -71,6 +71,10 @@ export default {
},
setup(props, ctx) {
const initials = computed(() => {
+ if (props.username == "?") {
+ return "?";
+ }
+
let parts = props.username.split(/[ -]/);
let initials = "";
for (var i = 0; i < parts.length; i++) {
diff --git a/frontend/src/components/PrincipalAvatar.vue b/frontend/src/components/PrincipalAvatar.vue
index 7c59e7752b..55dcde35c2 100644
--- a/frontend/src/components/PrincipalAvatar.vue
+++ b/frontend/src/components/PrincipalAvatar.vue
@@ -1,11 +1,12 @@
<template>
- <BBAvatar :username="principal.name" :size="size" />
+ <BBAvatar :username="username" :size="size" />
</template>
<script lang="ts">
-import { PropType } from "@vue/runtime-core";
+import { computed, PropType } from "@vue/runtime-core";
import { BBAvatarSizeType } from "../bbkit/types";
-import { Principal } from "../types";
+import { Principal, UNKNOWN_ID } from "../types";
+
export default {
name: "PrincipalAvatar",
props: {
@@ -19,7 +20,13 @@ export default {
},
},
setup(props, ctx) {
- return {};
+ const username = computed((): string => {
+ if (props.principal.id == UNKNOWN_ID) {
+ return "?";
+ }
+ return props.principal.name;
+ });
+ return { username };
},
};
</script>