Skip to content

Commit

Permalink
fix(friends): online status is hidden if not friend (#3680)
Browse files Browse the repository at this point in the history
  • Loading branch information
vimercati-samir committed Jun 22, 2022
1 parent 7ccc7d9 commit 608090f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/ui/User/State/State.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

<script lang="ts">
import Vue, { PropType } from 'vue'
import { SmartphoneIcon } from 'satellite-lucide-icons'
import { User } from '~/types/ui/user'
Expand Down
8 changes: 7 additions & 1 deletion components/views/friends/friend/Friend.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<div class="friend" data-cy="friend">
<UiUserState :user="friend" :src="src" />
<UiUserState v-if="showStatus" :user="friend" :src="src" />
<UiCircle
v-else
:type="src ? 'image' : 'random'"
:seed="friend.address"
:source="src"
/>
<div class="description">
<TypographySubtitle :size="6" :text="friend.name" data-cy="friend-name" />
<TypographyText :text="friend.status" />
Expand Down
10 changes: 10 additions & 0 deletions components/views/friends/friend/Friend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
CircleIcon,
SmartphoneIcon,
} from 'satellite-lucide-icons'
import { mapState, mapGetters } from 'vuex'
import { ContextMenuItem } from '~/store/ui/types'
import { Friend } from '~/types/ui/friends'
import ContextMenu from '~/components/mixins/UI/ContextMenu'
Expand Down Expand Up @@ -55,6 +57,8 @@ export default Vue.extend({
}
},
computed: {
...mapGetters('friends', ['friendExists']),
...mapState(['accounts']),
src(): string {
const hash =
this.friend?.photoHash ||
Expand All @@ -65,6 +69,12 @@ export default Vue.extend({
contextMenuValues(): ContextMenuItem[] {
return [{ text: this.$t('context.remove'), func: this.removeFriend }]
},
showStatus(): boolean {
return (
this.friendExists(this.$props.friend.address) ||
this.$props.friend.address === this.accounts.active
)
},
},
beforeDestroy() {
this.$store.commit('ui/toggleContextMenu', false)
Expand Down

0 comments on commit 608090f

Please sign in to comment.