this repo has no description
0
fork

Configure Feed

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

Fix the dev test post, it had no type!


Signed-off-by: MLC Bloeiman <mar@strawmelonjuice.com>

+22 -1
+2 -1
server/src/main.rs
··· 267 267 println!( 268 268 "Created two users with password 'MyTestPassw9292!' and usernames 'testuser1' and 'testuser2'." 269 269 ); 270 - sqlx::query!("INSERT INTO post_text (id, author_id, content, created_at) VALUES ($1, $2, $3, CURRENT_TIMESTAMP) ON CONFLICT (id) DO NOTHING", 270 + sqlx::query!("INSERT INTO post_text (id, author_id, content, created_at) VALUES ($1, $2, $3, CURRENT_TIMESTAMP)", 271 271 &generated_uuid, &user_1.id, &hello_content 272 272 ) 273 273 .execute(&pg_pool) ··· 278 278 &db, 279 279 &Uuid::nil(), 280 280 &generated_uuid, 281 + crate::timeline::ItemType::Text, 281 282 ) 282 283 .await 283 284 .unwrap_or(());
+20
server/src/timeline.rs
··· 345 345 db: &DbConn, 346 346 timeline: &Uuid, 347 347 item: &Uuid, 348 + item_type: ItemType, 348 349 ) -> Result<(), LuminaError> { 349 350 // Add to database 350 351 match db { ··· 357 358 .execute(pg_pool) 358 359 .await?; 359 360 361 + sqlx::query!( 362 + "INSERT INTO itemtypes (itemtype, item_id) VALUES ($1, $2)", 363 + match item_type { 364 + ItemType::Text => "text", 365 + ItemType::Article => "article", 366 + ItemType::Media => "media", 367 + }, 368 + item, 369 + ) 370 + .execute(pg_pool) 371 + .await?; 372 + 360 373 // Invalidate cache 361 374 let mut redis_conn = redis_pool.get().await?; 362 375 if let Err(e) = invalidate_timeline_cache(&mut redis_conn, *timeline).await { ··· 371 384 } 372 385 373 386 Ok(()) 387 + } 388 + 389 + pub(crate) enum ItemType { 390 + Text, 391 + Article, 392 + Media, 393 + // ... More 374 394 } 375 395 376 396 #[expect(dead_code, reason = "Not used yet")]