| @@ -308,14 +308,16 @@ func (db *DB) ListLikedArticles(ctx context.Context, userDID string, limit, offs |
| 308 | rows, err := db.QueryContext(ctx, ` | 308 | rows, err := db.QueryContext(ctx, ` |
| 309 | SELECT DISTINCT a.id, a.feed_url, a.guid, a.title, a.url, a.author, a.summary, a.content, | 309 | SELECT DISTINCT a.id, a.feed_url, a.guid, a.title, a.url, a.author, a.summary, a.content, |
| 310 | a.published, a.updated, a.fetched_at, | 310 | a.published, a.updated, a.fetched_at, |
| 311 | - COALESCE(f.title, '') | 311 | + COALESCE(f.title, ''), |
| | 312 | + COALESCE(r.is_read, 0) |
| 312 | FROM likes l | 313 | FROM likes l |
| 313 | JOIN articles a ON a.url = l.article_url AND a.feed_url = l.feed_url | 314 | JOIN articles a ON a.url = l.article_url AND a.feed_url = l.feed_url |
| 314 | LEFT JOIN feeds f ON f.feed_url = a.feed_url | 315 | LEFT JOIN feeds f ON f.feed_url = a.feed_url |
| | 316 | + LEFT JOIN read_state r ON r.user_did = ? AND r.article_id = a.id |
| 315 | WHERE l.author_did = ? | 317 | WHERE l.author_did = ? |
| 316 | ORDER BY l.created_at DESC | 318 | ORDER BY l.created_at DESC |
| 317 | LIMIT ? OFFSET ? | 319 | LIMIT ? OFFSET ? |
| 318 | - `, userDID, limit, offset) | 320 | + `, userDID, userDID, limit, offset) |
| 319 | if err != nil { | 321 | if err != nil { |
| 320 | return nil, err | 322 | return nil, err |
| 321 | } | 323 | } |
| @@ -326,7 +328,7 @@ func (db *DB) ListLikedArticles(ctx context.Context, userDID string, limit, offs |
| 326 | a := &Article{} | 328 | a := &Article{} |
| 327 | if err := rows.Scan(&a.ID, &a.FeedURL, &a.GUID, &a.Title, &a.URL, &a.Author, | 329 | if err := rows.Scan(&a.ID, &a.FeedURL, &a.GUID, &a.Title, &a.URL, &a.Author, |
| 328 | &a.Summary, &a.Content, &a.Published, &a.Updated, &a.FetchedAt, | 330 | &a.Summary, &a.Content, &a.Published, &a.Updated, &a.FetchedAt, |
| 329 | - &a.FeedTitle); err != nil { | 331 | + &a.FeedTitle, &a.IsRead); err != nil { |
| 330 | return nil, err | 332 | return nil, err |
| 331 | } | 333 | } |
| 332 | articles = append(articles, a) | 334 | articles = append(articles, a) |