Fix inbox relays, add time functions

This commit is contained in:
Jon Staab
2024-10-02 11:51:14 -07:00
parent b12f4aec4d
commit 7af86f42cf
7 changed files with 126 additions and 10 deletions
+8 -3
View File
@@ -9,7 +9,7 @@ import {repository, load} from './core'
import {createSearch} from './util'
import {collection} from './collection'
import {loadRelaySelections} from './relaySelections'
import {getUserWotScore} from './wot'
import {wotGraph} from './wot'
export const profiles = withGetter(
deriveEventsMapped<PublishedProfile>(repository, {
@@ -58,8 +58,13 @@ export const profileSearch = derived(profiles, $profiles =>
createSearch($profiles, {
onSearch: searchProfiles,
getValue: (profile: PublishedProfile) => profile.event.pubkey,
sortFn: ({score, item}) =>
score! < 0.1 ? dec(score!) * getUserWotScore(item.event.pubkey) : -score!,
sortFn: ({score, item}) => {
if (score && score > 0.1) return -score!
const wotScore = wotGraph.get().get(item.event.pubkey) || 0
return score ? dec(score) * wotScore : -wotScore
},
fuseOptions: {
keys: ["name", "display_name", {name: "about", weight: 0.3}],
threshold: 0.3,