@@ -28,8 +28,7 @@ const FEED_MIN_ITEMS = 20;
2828// Bounded pool size when pulling recommended events to dedupe + backfill from.
2929const RECOMMENDED_POOL_SIZE = 50 ;
3030// Bounded scan sizes for the interest-personalised recommendation pass. Kept
31- // small so the feed query stays cheap; the full ranking model lives on a
32- // separate branch and will replace this stub.
31+ // small so the feed query stays cheap while still providing relevant backfill.
3332const RECOMMENDED_ORG_SCAN = 100 ;
3433const RECOMMENDED_EVENTS_PER_ORG = 10 ;
3534
@@ -303,7 +302,7 @@ export const getById = query({
303302 args : { eventId : v . id ( "events" ) } ,
304303 handler : async ( ctx , args ) : Promise < HydratedEvent | null > => {
305304 const event = await ctx . db . get ( args . eventId ) ;
306- if ( event === null ) {
305+ if ( event === null || ! isPublished ( event ) ) {
307306 return null ;
308307 }
309308 const userId = await getAuthUserId ( ctx ) ;
@@ -407,8 +406,11 @@ export const getEmailContent = query({
407406 ctx ,
408407 args ,
409408 ) : Promise < { subject : string ; paragraphs : string [ ] } | null > => {
409+ const userId = await getAuthUserId ( ctx ) ;
410+ if ( userId === null ) return null ;
411+
410412 const event = await ctx . db . get ( args . eventId ) ;
411- if ( event === null ) return null ;
413+ if ( event === null || ! isPublished ( event ) ) return null ;
412414
413415 if ( event . sourceMessageId !== undefined ) {
414416 const msg = await ctx . db . get ( event . sourceMessageId ) ;
0 commit comments