File visibility from published usage + reliable file deletion#641
Open
jirkamotejl wants to merge 12 commits into
Open
File visibility from published usage + reliable file deletion#641jirkamotejl wants to merge 12 commits into
jirkamotejl wants to merge 12 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Folio::File#used_in_published_content?— live check whether a file is used in at least one published piece of content. Unwraps atoms to their parent record, respects the owner'spublished?(incl.published_at), ignores orphaned placements, counts owners without a publish concept as published. Early-exit batched iteration; single-record use only (collections need an SQL scope). Intended for host apps that derive public visibility of standalone file pages (e.g. video detail) from usage.file_placements_countno longer blocks file destroy. NewFolio::File#live_indestructible_reasonre-verifies the placements message with a live query; used by the model destroy guard, the console file detail and the API destroy. File lists keep the cheap counter. Host-appindestructible_reasonoverrides keep working (non-placements reasons pass through).folio:files:recalculate_placement_counts(counter drift fix,DRY_RUN/ALL_VIDEOS) andfolio:files:report_videos_without_published_usage(CSV report).dependent: :destroyfrom friendly_id) and CRA media cleanup job enqueue on destroy — no behavior change there.Notes
calculate_published_usage_count/published_usage_countsemantics are intentionally unchanged (consumed by usage-limit licensing) — the new visibility check is a separate, documented measure.Tests
Model, controller (console + API) and component tests included; suites green.