fix(provenance): scope attachments to originating post + scroll-cap the list
The Attachments section aggregated PostAttachment rows across EVERY post an image was pHash-linked to. When one of those was a 'High Resolution Files' mega-bundle (dozens of unrelated archives), the list ballooned past the viewport and overwhelmed the modal's right rail. - for_image() now scopes attachments to ImageRecord.primary_post_id (the post the file was actually captured from), falling back to all linked posts only when primary_post_id is unset (older rows / filesystem imports). - ProvenancePanel wraps the list in a max-height scroll container with a count in the heading, mirroring the cards' independent-scroll treatment. Note: FC stores archives as opaque blobs and never records which archive an extracted image came from, so attachments can't yet be scoped tighter than the post. Capturing image->archive containment is tracked as separate work. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -85,7 +85,22 @@ class ProvenanceService:
|
||||
)
|
||||
rows = (await self.session.execute(stmt)).all()
|
||||
post_ids = [ip.post_id for ip, _p, _s, _a in rows]
|
||||
attachments = await self._attachments_for_posts(post_ids)
|
||||
# Scope attachments to the image's ORIGINATING post only, not every
|
||||
# post it's pHash-linked to. An image dupe gets a provenance row per
|
||||
# post it reappears in (enrich-on-duplicate), and one of those is
|
||||
# often a "High Resolution Files" mega-bundle carrying dozens of
|
||||
# unrelated archives — aggregating across all linked posts ballooned
|
||||
# the panel with files that have nothing to do with this image.
|
||||
# primary_post_id is the post this file was actually captured from;
|
||||
# fall back to all linked posts only when it's unset (older rows /
|
||||
# filesystem imports). NB: FC stores archives as opaque blobs and
|
||||
# never records which archive an extracted image came from, so we
|
||||
# cannot scope tighter than the post — see milestone for the
|
||||
# image->archive capture work.
|
||||
attach_post_ids = (
|
||||
[rec.primary_post_id] if rec.primary_post_id is not None else post_ids
|
||||
)
|
||||
attachments = await self._attachments_for_posts(attach_post_ids)
|
||||
return {
|
||||
"image_id": image_id,
|
||||
"provenance": [
|
||||
|
||||
Reference in New Issue
Block a user