fix: wire showHidden param through suggestions API, remove dead code

This commit is contained in:
Jennie Robinson Faber 2026-04-05 17:00:06 +01:00
parent ed33cbb9e7
commit 6573e30d31
2 changed files with 5 additions and 15 deletions

View file

@ -13,7 +13,7 @@
<template v-else> <template v-else>
<!-- Filter Bar --> <!-- Filter Bar -->
<div v-if="tagOptions.length > 0 || stateOptions.length > 0" class="filter-bar"> <div v-if="tagOptions.length > 0" class="filter-bar">
<select <select
v-model="filterTag" v-model="filterTag"
class="filter-select" class="filter-select"
@ -340,7 +340,6 @@ const filterState = ref('')
const showHidden = ref(false) const showHidden = ref(false)
const hiddenCount = ref(0) const hiddenCount = ref(0)
const tagOptions = ref([]) const tagOptions = ref([])
const stateOptions = ref([])
const craftTagOptions = ref([]) const craftTagOptions = ref([])
// State display text // State display text
@ -361,15 +360,6 @@ const craftTagLabel = (slug) => {
return found ? found.label : slug return found ? found.label : slug
} }
// Build tag options from the current member's cooperative topics
const buildTagOptions = () => {
const topics = memberData.value?.communityConnections?.topics || []
tagOptions.value = topics.map(t => ({
slug: t.tagSlug,
label: cooperativeTagLabel(t.tagSlug),
}))
}
// Helpers // Helpers
const getInitials = (name) => { const getInitials = (name) => {
if (!name) return '?' if (!name) return '?'
@ -402,6 +392,7 @@ const loadSuggestions = async () => {
const params = {} const params = {}
if (filterTag.value) params.tag = filterTag.value if (filterTag.value) params.tag = filterTag.value
if (filterState.value) params.state = filterState.value if (filterState.value) params.state = filterState.value
if (showHidden.value) params.showHidden = 'true'
const data = await getSuggestions(params) const data = await getSuggestions(params)
suggestions.value = data.suggestions || [] suggestions.value = data.suggestions || []
} catch (error) { } catch (error) {
@ -512,8 +503,6 @@ const handleWithdraw = async (connectionId) => {
} }
const handleShowHiddenToggle = async () => { const handleShowHiddenToggle = async () => {
// Reload suggestions the API excludes hidden by default
// When showing hidden, we'd need an endpoint param; for now just reload
await loadSuggestions() await loadSuggestions()
} }

View file

@ -14,6 +14,7 @@ export default defineEventHandler(async (event) => {
const query = getQuery(event) const query = getQuery(event)
const filterTag = query.tag || null const filterTag = query.tag || null
const filterState = query.state || null const filterState = query.state || null
const showHidden = query.showHidden === 'true'
// Build the set of tag slugs to match against // Build the set of tag slugs to match against
let myTopics = topics let myTopics = topics
@ -65,8 +66,8 @@ export default defineEventHandler(async (event) => {
if (conn.status === 'confirmed' || conn.status === 'pending') { if (conn.status === 'confirmed' || conn.status === 'pending') {
excludeIds.add(otherId) excludeIds.add(otherId)
} }
// Exclude if current member has hidden this connection // Exclude if current member has hidden this connection (unless showHidden)
if (conn.hiddenBy?.some(id => id.toString() === memberId.toString())) { if (!showHidden && conn.hiddenBy?.some(id => id.toString() === memberId.toString())) {
excludeIds.add(otherId) excludeIds.add(otherId)
} }
} }