A social RSS reader built on the AT Protocol. glean.at
glean atproto atmosphere rss feed social app
14
fork

Configure Feed

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

Fix show unread article on articles page

+2 -23
-21
internal/db/article.go
··· 355 355 return a, nil 356 356 } 357 357 358 - func (db *DB) GetReadCount(ctx context.Context, userDID, feedURL string) (int, error) { 359 - var count int 360 - if feedURL != "" { 361 - err := db.QueryRowContext(ctx, ` 362 - SELECT COUNT(*) 363 - FROM articles a 364 - JOIN read_state r ON r.user_did = ? AND r.article_id = a.id 365 - WHERE a.feed_url = ? AND r.is_read = 1 366 - `, userDID, feedURL).Scan(&count) 367 - return count, err 368 - } 369 - err := db.QueryRowContext(ctx, ` 370 - SELECT COUNT(*) 371 - FROM articles a 372 - JOIN subscriptions s ON a.feed_url = s.feed_url AND s.user_did = ? 373 - JOIN read_state r ON r.user_did = ? AND r.article_id = a.id 374 - WHERE r.is_read = 1 375 - `, userDID, userDID).Scan(&count) 376 - return count, err 377 - } 378 - 379 358 func (db *DB) CountNewArticles(ctx context.Context, userDID string, since time.Time) (int, error) { 380 359 var count int 381 360 err := db.QueryRowContext(ctx, `
+2 -2
internal/server/articles_handler.go
··· 39 39 page := pageFromRequest(r, 50) 40 40 41 41 if status == "" && searchQuery == "" { 42 - readCount, _ := s.db.GetReadCount(r.Context(), user.DID, feedURL) 43 - if readCount > 0 { 42 + unreadCount, _ := s.db.GetUnreadCount(r.Context(), user.DID, feedURL) 43 + if unreadCount > 0 { 44 44 status = "unread" 45 45 } 46 46 }