feat(slint): featured-aware blacklist filtering on discovery/catalog surfaces; re-filter scene cache (D-FIX-c)
cc
This commit is contained in:
5 files changed
+129
-14
No files matched your search
@@ -1219,6 +1219,11 @@ pub fn apply_mb_discovery(window: &AppWindow, data: MbDiscoveryData) {
|
||||
let rows: Vec<DiscoveryArtist> = data
|
||||
.artists
|
||||
.into_iter()
|
||||
// T8: smart-discovery rail (v2_get_discovery_artists equivalent) —
|
||||
// skip candidates whose resolved Qobuz id is blacklisted.
|
||||
// is_blacklisted_id_str auto-gates on the enabled flag and treats a
|
||||
// missing/non-numeric id as not-blacklisted (kept).
|
||||
.filter(|r| !crate::artist_blacklist::is_blacklisted_id_str(&r.qobuz_id))
|
||||
.map(|r| DiscoveryArtist {
|
||||
mbid: r.mbid.into(),
|
||||
name: r.name.into(),
|
||||
|
||||
@@ -73,8 +73,21 @@ pub fn navigate(
|
||||
.get_discover_albums(&endpoint_for_fetch, genre_for_fetch, 0, PAGE_SIZE)
|
||||
.await
|
||||
{
|
||||
Ok(data) => {
|
||||
Ok(mut data) => {
|
||||
let has_more = data.has_more;
|
||||
// T8: drop blacklisted DiscoverAlbums (ANY of artists[],
|
||||
// featured-aware via discover_album_blacklisted). Tauri's
|
||||
// discover surfaces log-only — no count adjustment (the
|
||||
// endpoints carry no `total`; pagination is has_more-driven).
|
||||
let bl = if crate::artist_blacklist::is_enabled() {
|
||||
crate::artist_blacklist::ids_snapshot()
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
if !bl.is_empty() {
|
||||
data.items
|
||||
.retain(|a| !qbz_core::core::discover_album_blacklisted(a, &bl));
|
||||
}
|
||||
// CardData is plain/Send — map it to the (non-Send)
|
||||
// AlbumCardItem inside the event-loop closure below.
|
||||
let cards: Vec<CardData> =
|
||||
@@ -137,8 +150,19 @@ pub fn load_more(
|
||||
.get_discover_albums(&endpoint, genre_ids, offset, PAGE_SIZE)
|
||||
.await
|
||||
{
|
||||
Ok(data) => {
|
||||
Ok(mut data) => {
|
||||
let has_more = data.has_more;
|
||||
// T8: same featured-aware drop as the first page (log-only,
|
||||
// no count adjustment).
|
||||
let bl = if crate::artist_blacklist::is_enabled() {
|
||||
crate::artist_blacklist::ids_snapshot()
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
if !bl.is_empty() {
|
||||
data.items
|
||||
.retain(|a| !qbz_core::core::discover_album_blacklisted(a, &bl));
|
||||
}
|
||||
let cards: Vec<CardData> =
|
||||
data.items.into_iter().map(crate::home::map_album).collect();
|
||||
let jobs = artwork_jobs(&cards, offset as usize);
|
||||
|
||||
@@ -141,7 +141,24 @@ where
|
||||
A: FrontendAdapter + Send + Sync + 'static,
|
||||
{
|
||||
match runtime.core().get_release_watch("artists", 18, 0).await {
|
||||
Ok(page) => page.items.into_iter().map(map_album).collect(),
|
||||
Ok(page) => {
|
||||
// T8: drop blacklisted flat Albums (primary OR any-artist,
|
||||
// featured-aware via album_blacklisted). Tauri release-watch
|
||||
// also runs the availability filter and bundles BOTH removals
|
||||
// into one `total` decrement — this For You carousel surfaces
|
||||
// no count (it's a fixed 18-item rail) and applies no separate
|
||||
// availability filter, so we just drop the blacklisted rows.
|
||||
let bl = if crate::artist_blacklist::is_enabled() {
|
||||
crate::artist_blacklist::ids_snapshot()
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
page.items
|
||||
.into_iter()
|
||||
.filter(|a| !qbz_core::core::album_blacklisted(a, &bl))
|
||||
.map(map_album)
|
||||
.collect()
|
||||
}
|
||||
Err(_) => Vec::new(),
|
||||
}
|
||||
}
|
||||
@@ -188,14 +205,24 @@ where
|
||||
return Vec::new();
|
||||
}
|
||||
match runtime.core().get_album_suggest(album_id).await {
|
||||
Ok(resp) => resp
|
||||
.albums
|
||||
.map(|p| p.items)
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.take(18)
|
||||
.map(map_album)
|
||||
.collect(),
|
||||
Ok(resp) => {
|
||||
// T8: similar-albums (flat Album). Filter-then-truncate: drop
|
||||
// blacklisted BEFORE take(18) (Tauri parity — may yield fewer
|
||||
// than the limit, no backfill).
|
||||
let bl = if crate::artist_blacklist::is_enabled() {
|
||||
crate::artist_blacklist::ids_snapshot()
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
resp.albums
|
||||
.map(|p| p.items)
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.filter(|a| !qbz_core::core::album_blacklisted(a, &bl))
|
||||
.take(18)
|
||||
.map(map_album)
|
||||
.collect()
|
||||
}
|
||||
Err(_) => Vec::new(),
|
||||
}
|
||||
}
|
||||
@@ -231,6 +258,15 @@ where
|
||||
if to_follow.len() >= FOLLOW_MAX {
|
||||
break 'outer;
|
||||
}
|
||||
// T8: similar-artists surface — drop blacklisted artist ids
|
||||
// (is_blacklisted auto-gates on the enabled flag). This is
|
||||
// the v2_get_similar_artists equivalent; the carousel has no
|
||||
// surfaced total to decrement, so a drop just yields fewer
|
||||
// rows. NOT to be confused with the artist-detail page's own
|
||||
// similar list (a parity-negative left untouched).
|
||||
if crate::artist_blacklist::is_blacklisted(artist.id) {
|
||||
continue;
|
||||
}
|
||||
if seen.insert(artist.id) {
|
||||
to_follow.push(map_artist(artist, false));
|
||||
}
|
||||
|
||||
@@ -152,7 +152,36 @@ where
|
||||
.get_discover_index(genre_ids)
|
||||
.await
|
||||
.map_err(|e| e.to_string())?;
|
||||
let containers = response.containers;
|
||||
let mut containers = response.containers;
|
||||
|
||||
// T8: drop blacklisted DiscoverAlbums (ANY of artists[], featured-aware)
|
||||
// from the discover-index containers. Tauri filters exactly these six
|
||||
// containers (ideal_discography, new_releases, qobuzissims, most_streamed,
|
||||
// press_awards, album_of_the_week) and adjusts NO count — log-only parity
|
||||
// (the carousels are has_more/cache-driven, not total-driven).
|
||||
{
|
||||
let bl = if crate::artist_blacklist::is_enabled() {
|
||||
crate::artist_blacklist::ids_snapshot()
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
if !bl.is_empty() {
|
||||
let retain = |c: &mut Option<DiscoverContainer<DiscoverAlbum>>| {
|
||||
if let Some(container) = c.as_mut() {
|
||||
container
|
||||
.data
|
||||
.items
|
||||
.retain(|a| !qbz_core::core::discover_album_blacklisted(a, &bl));
|
||||
}
|
||||
};
|
||||
retain(&mut containers.new_releases);
|
||||
retain(&mut containers.qobuzissims);
|
||||
retain(&mut containers.press_awards);
|
||||
retain(&mut containers.most_streamed);
|
||||
retain(&mut containers.ideal_discography);
|
||||
retain(&mut containers.album_of_the_week);
|
||||
}
|
||||
}
|
||||
|
||||
// Editorial-only set for the Editor's Picks tab — built first
|
||||
// (by cloning the containers) so the same data can also feed the
|
||||
|
||||
@@ -69,11 +69,32 @@ where
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
let _ = response.next_offset; // offset is recomputed from row_count
|
||||
|
||||
// T8 + D-FIX-c: drop blacklisted scene candidates by resolved Qobuz id.
|
||||
//
|
||||
// D-FIX-c note: the Slint scene controller does NOT cache results (no
|
||||
// 30-day TTL cache exists in `qbz-core::discover_artists_by_location` nor
|
||||
// here — the Tauri bug was in the Tauri-only `integrations.rs` command
|
||||
// cache, which has no analogue in this path). We still re-apply the
|
||||
// blacklist HERE, on every result on the way out, so that even if any
|
||||
// upstream cache were ever introduced, a newly-blocked artist disappears
|
||||
// immediately. `is_blacklisted` auto-gates on the enabled flag; a
|
||||
// missing/None Qobuz id is kept (fail-open). `total` is decremented by
|
||||
// the number removed so the count stays honest.
|
||||
let mut artists = response.artists;
|
||||
let before = artists.len();
|
||||
artists.retain(|c| match c.qobuz_id {
|
||||
Some(id) if id >= 0 => !crate::artist_blacklist::is_blacklisted(id as u64),
|
||||
_ => true,
|
||||
});
|
||||
let removed = before - artists.len();
|
||||
let total = response.total_candidates.saturating_sub(removed);
|
||||
|
||||
Ok(LocationData {
|
||||
scene_label: response.scene_label,
|
||||
genre_summary: response.genre_summary,
|
||||
artists: response.artists.into_iter().map(map_candidate).collect(),
|
||||
total: response.total_candidates,
|
||||
artists: artists.into_iter().map(map_candidate).collect(),
|
||||
total,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user