Add all_evidence to content service and cascade upload state to Evidence - #127
Open
caitmich wants to merge 9 commits into
Open
Add all_evidence to content service and cascade upload state to Evidence#127caitmich wants to merge 9 commits into
all_evidence to content service and cascade upload state to Evidence#127caitmich wants to merge 9 commits into
Conversation
all_evidence to content service and cascade upload state to Evidence
etdsoft
reviewed
Aug 31, 2026
…eady exists and memoize evidence_for per issue, keeping it an AR relation instead of loading all evidence upfront
aapomm
reviewed
Sep 3, 2026
aapomm
reviewed
Sep 3, 2026
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.
Summary
Dradis::Plugins::ContentService::Evidence#all_evidence, mirroring the existingIssues#all_issuesandContentBlocks#all_content_blocks:This lets export plugins fetch Evidence already scoped to the export's
:published/:allscope, the same way they already do for Issues and Content Blocks, instead of re-queryingnode.evidence/issue.evidencethemselves inside export processors.create_evidenceso it cascades the upload's chosen:stateto newly created Evidence records, matchingcreate_issue's existing behaviour(Needed by the Word & Excel export PRs (dradis-pro#2938, dradis-pro#2951) and by
html_export/csv_export(#99, #57), all of which fetchall_evidenceonce per export and group/filter it in memory per Issue rather than re-querying per Issue. Evidence's independentpublished/draft/ready_for_reviewreview state was added in dradis-ce/dradis-pro branchqa/add-evidence-review-state; this PR requiresEvidence#published(a Rails enum scope), which that branch adds, to exist on the host app'sEvidencemodel.)Testing Steps
From the Dradis Pro app directory, with this gem checked out at a sibling path, temporarily point the Gemfile at this branch/path and run:
Assert all examples pass, confirming:
all_evidencereturns only published evidence by default and all evidence when scope is:all;create_evidencesets the new record's state from the:stateargument (or the service's default state when none is given); and re-uploading matching content does not change an existing evidence record's state.Other Information
Once merged, this needs a version bump + gem release, and the dependent PRs above need their temporary local path/branch overrides in the Gemfile switched to the released version.
Check List