AllowedTags and BlockUnratedItems are modelled nowhere #129
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two halves of upstream's visibility rule that this port does not implement at all — consistently absent from both listings and by-id reads, so nothing is inconsistent, and nothing is enforced either.
AllowedTagsis the other half ofIsVisibleViaTags.BlockedTagsis now honoured (#111); an account restricted to an allowlist of tags is not.BlockUnratedItemsis the branch ofIsParentalAllowedthat decides what happens to an item carrying no rating at all, per item type. An operator who has blocked unrated items is currently shown every unrated item.The second is the one that bites in a real library:
InheritedParentalRatingValueis only as good as the metadata, and a scan of files with no NFO and no fetcher produces rows with no rating. An account limited to PG sees all of them today.Where to start
BaseItem.IsParentalAllowedandIsVisibleViaTagsinupstream/, and theUserpolicy fields they read. Here:jellyfin_core::visibility::Vieweris the type that already carries the rating limit and the blocked tags, andjellyfin-db'swithin_the_rating/untaggedare where the SQL goes.BlockUnratedItemsis per item type, not a single flag — check what upstream does for a folder and for a series whose episodes differ, because the answer decides whether this is a column comparison or a walk.How to know it is done
An account with an allowlist and one with unrated items blocked answer the same as upstream on both a listing and a by-id read, measured on a pair with real accounts.
House rules
Tests run under
cargo nextest; upstream's source is the checkout inupstream/at the pin; generated files are regenerated rather than edited; comments say what the code does, not how it got there. Anything needing a write to the reference wants its own container rather than the shared one —#111did that and it worked: the pinned image over asqlite3 .backupcopy ofreference/var/config/data/jellyfin.db, on ports of its own.Done, on
main, with #128 — see the full write-up there.AllowedTagsis the other half ofIsVisibleViaTagsand is modelled now, with upstream's ordering kept: blocked tags are tested first, then a row whose first parent is aUserRootFolder,AggregateFolderorUserViewis exempt, then the allowlist applies. The exemption cannot leak into the blocked half.BlockUnratedItemsis per item kind, and which kinds answer for themselves is the rule: the default returns false for a folder and anIItemByName;Series,MusicAlbumandBoxSetoverride it; andSeasonexplicitly returns false, so a season is refused through the ancestor chain rather than by its own bucket. Measured against an account blocking all nine kinds — every season, episode and series 404, the music album still 200 because it answers only for theMusicbucket, the artist, the year and the library folders still 200. Upstream exactly.This was untestable until the fixture grew an account for it. Every row in the
defaultsnapshot is unrated, so a rating cap refuses nothing and a blocked tag matches nothing there —unrated/unratedwithBlockUnratedItems = ["Movie", "Series"](2dec147) is the one policy that bites, and it takes the account from the administrator's 19 items to 7.visibility.jsoncarries fifteen entries against it, including the three that must stay 200 — an album, an artist and a year by id — which are the over-blocking guard.An account blocking all nine kinds went from 25 disagreements to 3; one holding an allowlist from 22 to 1.