Skip to content

Commit

Permalink
fix: filter out profiles without fingerprint
Browse files Browse the repository at this point in the history
  • Loading branch information
SunriseFox authored and Jack-Works committed Dec 25, 2019
1 parent 0d54e3c commit 08e221e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/social-network-provider/options-page/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { GetContext, ValueRef } from '@holoflows/kit/es'
import { Profile, Persona } from '../../database'
import { createDataWithIdentifierChangedListener } from '../../social-network/defaults/createDataWithIdentifierChangedListener'

function hasFingerprint(x: Profile) {
return !!x.linkedPersona?.fingerprint
}

const optionsPageUISelf = defineSocialNetworkUI({
...emptyDefinition,
internalName: 'Options page data source',
Expand All @@ -23,9 +27,9 @@ const optionsPageUISelf = defineSocialNetworkUI({
const ref = optionsPageUISelf.friendsRef
MessageCenter.on(
'profilesChanged',
createDataWithIdentifierChangedListener(ref, () => true),
createDataWithIdentifierChangedListener(ref, e => hasFingerprint(e.of)),
)
Services.Identity.queryProfiles().then(p => (ref.value = p))
Services.Identity.queryProfiles().then(p => (ref.value = p.filter(hasFingerprint)))
}
{
const ref = optionsPageUISelf.myPersonasRef
Expand Down

0 comments on commit 08e221e

Please sign in to comment.