···1313 "arabica/internal/web/components"
1414 "arabica/internal/web/pages"
15151616+1617 "github.com/rs/zerolog/log"
1718)
1819···205206 recipe.RKey = rkey
206207 recipe.AuthorDID = ownerDID
207208208208- // Resolve brewer reference if present
209209+ // Resolve brewer reference: fetch source brewer info, then match
210210+ // against the current user's brewers so the returned brewer_rkey
211211+ // is usable in the current user's brew form.
209212 if brewerRef, ok := record.Value["brewerRef"].(string); ok && brewerRef != "" {
210210- if c, err := atproto.ResolveATURI(brewerRef); err == nil {
211211- recipe.BrewerRKey = c.RKey
212212- }
213213 brewerRKey := atproto.ExtractRKeyFromURI(brewerRef)
214214 if brewerRKey != "" {
215215 brewerRecord, err := publicClient.GetRecord(r.Context(), ownerDID, atproto.NSIDBrewer, brewerRKey)
···217217 if brewer, err := atproto.RecordToBrewer(brewerRecord.Value, brewerRecord.URI); err == nil {
218218 brewer.RKey = brewerRKey
219219 recipe.BrewerObj = brewer
220220+221221+ // Try to match source brewer to the current user's brewers
222222+ if userBrewers, err := store.ListBrewers(r.Context()); err == nil {
223223+ candidates := make([]matching.Candidate, len(userBrewers))
224224+ for i, b := range userBrewers {
225225+ candidates[i] = matching.Candidate{RKey: b.RKey, Name: b.Name, Type: b.BrewerType}
226226+ }
227227+ if m := matching.Match(brewer.Name, brewer.BrewerType, candidates); m != nil {
228228+ recipe.BrewerRKey = m.RKey
229229+ }
230230+ }
220231 }
221232 }
222233 }
+5-1
internal/handlers/suggestions.go
···5858 return
5959 }
60606161- results, err := suggestions.Search(h.feedIndex, nsid, query, limit)
6161+ // Exclude the current user's records from suggestions so they only see
6262+ // community records, not their own data echoed back.
6363+ excludeDID, _ := atproto.GetAuthenticatedDID(r.Context())
6464+6565+ results, err := suggestions.Search(h.feedIndex, nsid, query, limit, excludeDID)
6266 if err != nil {
6367 log.Error().Err(err).Str("entity", entityType).Str("query", query).Msg("Failed to search suggestions")
6468 http.Error(w, "Failed to search suggestions", http.StatusInternalServerError)
+12-1
internal/suggestions/suggestions.go
···208208// Search searches indexed records for entity suggestions matching a query.
209209// It matches against searchable fields, deduplicates using entity-specific
210210// keys, and returns results sorted by popularity.
211211-func Search(source RecordSource, collection, query string, limit int) ([]EntitySuggestion, error) {
211211+// If excludeDID is non-empty, records from that DID are excluded from results.
212212+func Search(source RecordSource, collection, query string, limit int, excludeDID ...string) ([]EntitySuggestion, error) {
212213 if limit <= 0 {
213214 limit = 10
214215 }
···223224 return nil, nil
224225 }
225226227227+ var skipDID string
228228+ if len(excludeDID) > 0 {
229229+ skipDID = excludeDID[0]
230230+ }
231231+226232 records, err := source.ListRecordsByCollection(collection)
227233 if err != nil {
228234 return nil, err
···237243 candidates := make(map[string]*candidate)
238244239245 for _, indexed := range records {
246246+ // Skip the current user's records so they only see community data
247247+ if skipDID != "" && indexed.DID == skipDID {
248248+ continue
249249+ }
250250+240251 var recordData map[string]any
241252 if err := json.Unmarshal(indexed.Record, &recordData); err != nil {
242253 continue