fix(podcasts): page search hits episode titles/descriptions (issue #8)
WHY: the /podcasts search box filtered feed CARDS only (title, display name, host, publisher, feed description). D14's episode search existed only as the /api/podcasts/search endpoint and was never wired into the page — searching 'Quarter' (present only in episode titles) cleared the grid while 'Trader' (feed metadata) survived. The page query now consults SearchMyPodcastEpisodes (subscription-scoped via RLS — the caller's identity) when a query is present; a feed surfaces when its OWN metadata OR any of its episodes matches, with an 'N matching episode(s)' badge on the card. PIN: SSR test with a needle that exists only in an episode title — the feed must surface with the match count.
This commit is contained in:
1 parent
c753780817
commit
ffc80f7ba7
5 files changed
+129
-38
No files matched your search
@@ -44,6 +44,11 @@ type PodcastFeedCard struct {
|
||||
AutoDownloadCount int
|
||||
Subscribed bool
|
||||
|
||||
// EpisodeMatches (issue #8): when a search query is active, the
|
||||
// number of the feed's episodes whose title/description matched —
|
||||
// feeds match on EPISODES too, not just their own metadata.
|
||||
EpisodeMatches int
|
||||
|
||||
// Continue aggregation (plan 2.5): the episode the user is midway
|
||||
// through, most recent first across feeds.
|
||||
HasContinue bool
|
||||
@@ -174,6 +179,14 @@ func podcastInt(n int) string {
|
||||
return fmt.Sprintf("%d", n)
|
||||
}
|
||||
|
||||
// podcastPlural returns "" for 1 and "s" otherwise.
|
||||
func podcastPlural(n int) string {
|
||||
if n == 1 {
|
||||
return ""
|
||||
}
|
||||
return "s"
|
||||
}
|
||||
|
||||
// timeStringPtr helper: display-format with empty fallback.
|
||||
func podcastTimeOrEmpty(t time.Time, valid bool, tz string) string {
|
||||
if !valid || t.IsZero() {
|
||||
|
||||
Reference in new issue
Block a user