fix(webapp): no distance to me on own profile (#8907)

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
This commit is contained in:
Moriz Wahl 2025-09-22 23:59:18 +02:00 committed by GitHub
parent 2ed92c0a78
commit 9a4f7326c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 115 additions and 8 deletions

View File

@ -4,7 +4,7 @@
<base-icon name="map-marker" />
{{ locationData.name }}
</div>
<div v-if="locationData.distanceToMe !== null" class="distance">
<div v-if="locationData.distanceToMe !== null && !isOwner" class="distance">
{{ $t('location.distance', { distance: locationData.distanceToMe }) }}
</div>
</div>
@ -22,6 +22,10 @@ export default {
return value.match(/(small|base)/)
},
},
isOwner: {
type: Boolean,
required: true,
},
},
}
</script>

View File

@ -4,7 +4,12 @@
v-if="$env.BADGES_ENABLED && user.badgeVerification"
:badges="[user.badgeVerification, ...user.badgeTrophiesSelected]"
/>
<location-info v-if="user.location" :location-data="user.location" class="location-info" />
<location-info
v-if="user.location"
:location-data="user.location"
:is-owner="userId === $store.getters['auth/user'].id"
class="location-info"
/>
<ul class="statistics">
<li>
<ds-number :count="user.followedByCount" :label="$t('profile.followers')" />

View File

@ -38,7 +38,12 @@
{{ `&${groupSlug}` }}
</ds-text>
<!-- group location -->
<location-info v-if="group.location" :location-data="group.location" size="small" />
<location-info
v-if="group.location"
:location-data="group.location"
:is-owner="false"
size="small"
/>
<!-- group created at -->
<ds-text align="center" color="soft" size="small">
{{ $t('group.foundation') }} {{ group.createdAt | date('MMMM yyyy') }}

View File

@ -181,7 +181,30 @@ exports[`ProfileSlug given an authenticated user given another profile user and
</p>
<!---->
<div
class="location-info size-small"
>
<div
class="location"
>
<span
class="base-icon"
>
<!---->
</span>
Berlin
</div>
<div
class="distance"
>
location.distance
</div>
</div>
<p
class="ds-text ds-text-size-small ds-text-soft ds-text-center"
@ -799,7 +822,30 @@ exports[`ProfileSlug given an authenticated user given another profile user and
</p>
<!---->
<div
class="location-info size-small"
>
<div
class="location"
>
<span
class="base-icon"
>
<!---->
</span>
Berlin
</div>
<div
class="distance"
>
location.distance
</div>
</div>
<p
class="ds-text ds-text-size-small ds-text-soft ds-text-center"
@ -1424,7 +1470,24 @@ exports[`ProfileSlug given an authenticated user given the logged in user as pro
</p>
<!---->
<div
class="location-info size-small"
>
<div
class="location"
>
<span
class="base-icon"
>
<!---->
</span>
Paris
</div>
<!---->
</div>
<p
class="ds-text ds-text-size-small ds-text-soft ds-text-center"
@ -1986,7 +2049,24 @@ exports[`ProfileSlug given an authenticated user given the logged in user as pro
</p>
<!---->
<div
class="location-info size-small"
>
<div
class="location"
>
<span
class="base-icon"
>
<!---->
</span>
Paris
</div>
<!---->
</div>
<p
class="ds-text ds-text-size-small ds-text-soft ds-text-center"

View File

@ -91,6 +91,10 @@ describe('ProfileSlug', () => {
contributionsCount: 6,
shoutedCount: 7,
commentedCount: 8,
location: {
name: 'Berlin',
distanceToMe: '877 km',
},
badgeVerification: {
id: 'bv1',
icon: '/path/to/icon-bv1',
@ -149,6 +153,10 @@ describe('ProfileSlug', () => {
contributionsCount: 6,
shoutedCount: 7,
commentedCount: 8,
location: {
name: 'Paris',
distanceToMe: '0 km',
},
badgeVerification: {
id: 'bv1',
icon: '/path/to/icon-bv1',

View File

@ -34,7 +34,12 @@
<!-- <base-icon name="at" data-test="at" /> -->
{{ `@${userSlug}` }}
</ds-text>
<location-info v-if="user.location" :location-data="user.location" size="small" />
<location-info
v-if="user.location"
:location-data="user.location"
:is-owner="myProfile"
size="small"
/>
<ds-text align="center" color="soft" size="small">
{{ $t('profile.memberSince') }} {{ user.createdAt | date('MMMM yyyy') }}
</ds-text>