grain.social is a photo sharing platform built on atproto. grain.social
atproto photography appview
47
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: allow empty search query in mention service for subscope browsing

Make search param optional so entering a user's gallery subscope
shows all their galleries by default without requiring a query.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+3 -3
+1 -1
hatk.generated.ts
··· 45 45 const putRecordLex = {"lexicon":1,"id":"dev.hatk.putRecord","defs":{"main":{"type":"procedure","description":"Create or update a record via the user's PDS.","input":{"encoding":"application/json","schema":{"type":"object","required":["collection","rkey","record"],"properties":{"collection":{"type":"string"},"rkey":{"type":"string"},"record":{"type":"unknown"},"repo":{"type":"string","format":"did"}}}},"output":{"encoding":"application/json","schema":{"type":"object","properties":{"uri":{"type":"string","format":"at-uri"},"cid":{"type":"string","format":"cid"}}}}}}} as const 46 46 const searchRecordsLex = {"lexicon":1,"id":"dev.hatk.searchRecords","defs":{"main":{"type":"query","description":"Full-text search across a collection.","parameters":{"type":"params","required":["collection","q"],"properties":{"collection":{"type":"string"},"q":{"type":"string","description":"Search query"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20},"cursor":{"type":"string"},"fuzzy":{"type":"boolean","default":true}}},"output":{"encoding":"application/json","schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"unknown"}},"cursor":{"type":"string"}}}}}}} as const 47 47 const uploadBlobLex = {"lexicon":1,"id":"dev.hatk.uploadBlob","defs":{"main":{"type":"procedure","description":"Upload a blob via the user's PDS.","input":{"encoding":"*/*"},"output":{"encoding":"application/json","schema":{"type":"object","required":["blob"],"properties":{"blob":{"type":"blob"}}}}}}} as const 48 - const searchLex = {"lexicon":1,"id":"parts.page.mention.search","defs":{"main":{"type":"query","description":"Search a mention service for matching results.","parameters":{"type":"params","required":["service","search"],"properties":{"service":{"type":"string","format":"at-uri","description":"AT URI of the parts.page.mention.service record"},"search":{"type":"string","description":"Search query string"},"scope":{"type":"string","description":"Optional scope identifier to narrow results"},"limit":{"type":"integer","minimum":1,"maximum":50,"default":20}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["results"],"properties":{"results":{"type":"array","items":{"type":"ref","ref":"#result"},"maxLength":50}}}}},"result":{"type":"object","required":["uri","name"],"properties":{"uri":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"labels":{"type":"array","items":{"type":"ref","ref":"#mentionLabel"}},"href":{"type":"string","format":"uri"},"icon":{"type":"string","format":"uri"},"embed":{"type":"ref","ref":"#embedInfo"},"subscope":{"type":"ref","ref":"#subscopeInfo"}}},"mentionLabel":{"type":"object","properties":{"text":{"type":"string"}}},"embedInfo":{"type":"object","required":["src"],"properties":{"src":{"type":"string","format":"uri"},"width":{"type":"integer","minimum":16,"maximum":3200},"height":{"type":"integer","minimum":16,"maximum":3200},"aspectRatio":{"type":"ref","ref":"#aspectRatio"}}},"aspectRatio":{"type":"object","required":["width","height"],"properties":{"width":{"type":"integer"},"height":{"type":"integer"}}},"subscopeInfo":{"type":"object","required":["scope","label"],"properties":{"scope":{"type":"string"},"label":{"type":"string","maxLength":100}}}}} as const 48 + const searchLex = {"lexicon":1,"id":"parts.page.mention.search","defs":{"main":{"type":"query","description":"Search a mention service for matching results.","parameters":{"type":"params","required":["service"],"properties":{"service":{"type":"string","format":"at-uri","description":"AT URI of the parts.page.mention.service record"},"search":{"type":"string","description":"Search query string"},"scope":{"type":"string","description":"Optional scope identifier to narrow results"},"limit":{"type":"integer","minimum":1,"maximum":50,"default":20}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["results"],"properties":{"results":{"type":"array","items":{"type":"ref","ref":"#result"},"maxLength":50}}}}},"result":{"type":"object","required":["uri","name"],"properties":{"uri":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"labels":{"type":"array","items":{"type":"ref","ref":"#mentionLabel"}},"href":{"type":"string","format":"uri"},"icon":{"type":"string","format":"uri"},"embed":{"type":"ref","ref":"#embedInfo"},"subscope":{"type":"ref","ref":"#subscopeInfo"}}},"mentionLabel":{"type":"object","properties":{"text":{"type":"string"}}},"embedInfo":{"type":"object","required":["src"],"properties":{"src":{"type":"string","format":"uri"},"width":{"type":"integer","minimum":16,"maximum":3200},"height":{"type":"integer","minimum":16,"maximum":3200},"aspectRatio":{"type":"ref","ref":"#aspectRatio"}}},"aspectRatio":{"type":"object","required":["width","height"],"properties":{"width":{"type":"integer"},"height":{"type":"integer"}}},"subscopeInfo":{"type":"object","required":["scope","label"],"properties":{"scope":{"type":"string"},"label":{"type":"string","maxLength":100}}}}} as const 49 49 const grainActorDefsLex = {"lexicon":1,"id":"social.grain.actor.defs","defs":{"profileView":{"type":"object","required":["cid","did","handle"],"properties":{"cid":{"type":"string","format":"cid"},"did":{"type":"string","format":"did"},"handle":{"type":"string","format":"handle"},"displayName":{"type":"string","maxGraphemes":64,"maxLength":640},"description":{"type":"string","maxLength":2560,"maxGraphemes":256},"labels":{"type":"array","items":{"ref":"com.atproto.label.defs#label","type":"ref"}},"avatar":{"type":"string","format":"uri"},"createdAt":{"type":"string","format":"datetime"}}},"profileViewDetailed":{"type":"object","required":["cid","did","handle"],"properties":{"cid":{"type":"string","format":"cid"},"did":{"type":"string","format":"did"},"handle":{"type":"string","format":"handle"},"displayName":{"type":"string","maxGraphemes":64,"maxLength":640},"description":{"type":"string","maxGraphemes":256,"maxLength":2560},"avatar":{"type":"string","format":"uri"},"cameras":{"type":"array","items":{"type":"string"},"description":"List of camera make and models used by this actor derived from EXIF data of photos linked to galleries."},"followersCount":{"type":"integer"},"followsCount":{"type":"integer"},"galleryCount":{"type":"integer"},"indexedAt":{"type":"string","format":"datetime"},"createdAt":{"type":"string","format":"datetime"},"messageMe":{"type":"ref","ref":"#messageMe"},"viewer":{"type":"ref","ref":"#viewerState"},"labels":{"type":"array","items":{"type":"ref","ref":"com.atproto.label.defs#label"}}}},"messageMe":{"type":"object","required":["showButtonTo","messageMeUrl"],"properties":{"messageMeUrl":{"type":"string","format":"uri"},"showButtonTo":{"type":"string","knownValues":["usersIFollow","everyone"]}}},"viewerState":{"type":"object","description":"Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests.","properties":{"following":{"type":"string","format":"at-uri"},"followedBy":{"type":"string","format":"at-uri"}}}}} as const 50 50 const grainActorProfileLex = {"lexicon":1,"id":"social.grain.actor.profile","defs":{"main":{"type":"record","description":"A declaration of a basic account profile.","key":"literal:self","record":{"type":"object","properties":{"displayName":{"type":"string","maxGraphemes":64,"maxLength":640},"description":{"type":"string","description":"Free-form profile description text.","maxGraphemes":256,"maxLength":2560},"avatar":{"type":"blob","description":"Small image to be displayed next to posts from account. AKA, 'profile picture'","accept":["image/png","image/jpeg"],"maxSize":1000000},"createdAt":{"type":"string","format":"datetime"}}}}}} as const 51 51 const commentLex = {"lexicon":1,"id":"social.grain.comment","defs":{"main":{"type":"record","key":"tid","record":{"type":"object","required":["text","subject","createdAt"],"properties":{"text":{"type":"string","maxLength":3000,"maxGraphemes":300},"facets":{"type":"array","description":"Annotations of description text (mentions and URLs, hashtags, etc)","items":{"type":"ref","ref":"app.bsky.richtext.facet"}},"subject":{"type":"string","format":"at-uri"},"focus":{"type":"string","format":"at-uri"},"replyTo":{"type":"string","format":"at-uri"},"createdAt":{"type":"string","format":"datetime"}}}}}} as const
+1 -1
lexicons/parts/page/mention/search.json
··· 7 7 "description": "Search a mention service for matching results.", 8 8 "parameters": { 9 9 "type": "params", 10 - "required": ["service", "search"], 10 + "required": ["service"], 11 11 "properties": { 12 12 "service": { 13 13 "type": "string",
+1 -1
server/xrpc/mentionSearch.ts
··· 7 7 8 8 export default defineQuery("parts.page.mention.search", async (ctx) => { 9 9 const { params, search, db, blobUrl, ok } = ctx; 10 - const { search: query, scope, limit = 20 } = params; 10 + const { search: query = "", scope, limit = 20 } = params; 11 11 12 12 // Scoped to a user DID → search their galleries 13 13 if (scope) {