feat: use email as fallback for display name (#2746)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Akash K
2022-10-07 00:45:34 +05:30
committed by GitHub
parent cbf6d23c24
commit d42434ddc0
8 changed files with 31 additions and 13 deletions

View File

@@ -336,7 +336,7 @@
"updated": "Profile updated", "updated": "Profile updated",
"viewer": "Viewer", "viewer": "Viewer",
"viewer_description": "Viewers can only view and use requests.", "viewer_description": "Viewers can only view and use requests.",
"default_hopp_displayname": "Hoppscotch User" "default_hopp_displayname": "Unnamed User"
}, },
"remove": { "remove": {
"star": "Remove star" "star": "Remove star"

View File

@@ -104,6 +104,7 @@ declare module '@vue/runtime-core' {
IconLucideSearch: typeof import('~icons/lucide/search')['default'] IconLucideSearch: typeof import('~icons/lucide/search')['default']
IconLucideUser: typeof import('~icons/lucide/user')['default'] IconLucideUser: typeof import('~icons/lucide/user')['default']
IconLucideUsers: typeof import('~icons/lucide/users')['default'] IconLucideUsers: typeof import('~icons/lucide/users')['default']
IconLucideVerified: typeof import('~icons/lucide/verified')['default']
LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default'] LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default']
LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default'] LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default']
LensesRenderersHTMLLensRenderer: typeof import('./components/lenses/renderers/HTMLLensRenderer.vue')['default'] LensesRenderersHTMLLensRenderer: typeof import('./components/lenses/renderers/HTMLLensRenderer.vue')['default']

View File

@@ -38,7 +38,7 @@
interactive interactive
trigger="click" trigger="click"
theme="popover" theme="popover"
:on-shown="() => tippyActions.focus()" :on-shown="() => tippyActions!.focus()"
> >
<ButtonSecondary <ButtonSecondary
:icon="IconHelpCircle" :icon="IconHelpCircle"
@@ -221,6 +221,8 @@ import { useSetting } from "@composables/settings"
import { useI18n } from "@composables/i18n" import { useI18n } from "@composables/i18n"
import { useReadonlyStream } from "@composables/stream" import { useReadonlyStream } from "@composables/stream"
import { currentUser$ } from "~/helpers/fb/auth" import { currentUser$ } from "~/helpers/fb/auth"
import { TippyComponent } from "vue-tippy"
import SmartItem from "@components/smart/Item.vue"
const t = useI18n() const t = useI18n()
const showShortcuts = ref(false) const showShortcuts = ref(false)
@@ -277,8 +279,8 @@ const showDeveloperOptionModal = () => {
} }
// Template refs // Template refs
const tippyActions = ref<any | null>(null) const tippyActions = ref<TippyComponent | null>(null)
const documentation = ref<any | null>(null) const documentation = ref<typeof SmartItem | null>(null)
const shortcuts = ref<any | null>(null) const shortcuts = ref<typeof SmartItem | null>(null)
const chat = ref<any | null>(null) const chat = ref<typeof SmartItem | null>(null)
</script> </script>

View File

@@ -77,6 +77,7 @@
" "
:title=" :title="
currentUser.displayName || currentUser.displayName ||
currentUser.email ||
t('profile.default_hopp_displayname') t('profile.default_hopp_displayname')
" "
indicator indicator
@@ -89,9 +90,10 @@
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title=" :title="
currentUser.displayName || currentUser.displayName ||
currentUser.email ||
t('profile.default_hopp_displayname') t('profile.default_hopp_displayname')
" "
:initial="currentUser.displayName" :initial="currentUser.displayName || currentUser.email"
indicator indicator
:indicator-styles=" :indicator-styles="
network.isOnline ? 'bg-green-500' : 'bg-red-500' network.isOnline ? 'bg-green-500' : 'bg-red-500'
@@ -100,7 +102,10 @@
<template #content="{ hide }"> <template #content="{ hide }">
<div class="flex flex-col px-2 text-tiny"> <div class="flex flex-col px-2 text-tiny">
<span class="inline-flex font-semibold truncate"> <span class="inline-flex font-semibold truncate">
{{ currentUser.displayName }} {{
currentUser.displayName ||
t("profile.default_hopp_displayname")
}}
</span> </span>
<span class="inline-flex truncate text-secondaryLight"> <span class="inline-flex truncate text-secondaryLight">
{{ currentUser.email }} {{ currentUser.email }}

View File

@@ -32,7 +32,11 @@
v-for="(member, index) in team.teamMembers" v-for="(member, index) in team.teamMembers"
:key="`member-${index}`" :key="`member-${index}`"
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="member.user.displayName" :title="
member.user.displayName ||
member.user.email ||
t('default_hopp_displayName')
"
class="inline-flex" class="inline-flex"
> >
<ProfilePicture <ProfilePicture
@@ -43,7 +47,7 @@
/> />
<ProfilePicture <ProfilePicture
v-else v-else
:initial="member.user.displayName" :initial="member.user.displayName || member.user.email"
class="ring-primary ring-2" class="ring-primary ring-2"
/> />
</div> </div>
@@ -193,6 +197,7 @@ const props = defineProps<{
user: { user: {
displayName: string displayName: string
photoURL: string | null photoURL: string | null
email: string | null
} }
}> }>
} }

View File

@@ -10,6 +10,7 @@ query GetInviteDetails($inviteID: ID!) {
creator { creator {
uid uid
displayName displayName
email
} }
} }
} }

View File

@@ -79,7 +79,8 @@
{{ {{
t("team.invited_to_team", { t("team.invited_to_team", {
owner: owner:
inviteDetails.data.right.teamInvitation.creator.displayName, inviteDetails.data.right.teamInvitation.creator.displayName ??
inviteDetails.data.right.teamInvitation.creator.email,
team: inviteDetails.data.right.teamInvitation.team.name, team: inviteDetails.data.right.teamInvitation.team.name,
}) })
}} }}

View File

@@ -46,14 +46,17 @@
/> />
<ProfilePicture <ProfilePicture
v-else v-else
:initial="currentUser.displayName" :initial="currentUser.displayName || currentUser.email"
rounded="lg" rounded="lg"
size="16" size="16"
class="ring-primary ring-4" class="ring-primary ring-4"
/> />
<div class="ml-4"> <div class="ml-4">
<label class="heading"> <label class="heading">
{{ currentUser.displayName || t("state.nothing_found") }} {{
currentUser.displayName ||
t("profile.default_hopp_displayname")
}}
</label> </label>
<p class="flex items-center text-secondaryLight"> <p class="flex items-center text-secondaryLight">
{{ currentUser.email }} {{ currentUser.email }}