Fix #1275: is_reviewed flag inconsistencies and media access control #1280
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.
Fixes #1275
Note: I am not a Python programmer and this fix was developed with heavy assistance from AI tools. While the solution has been carefully analyzed, it has not been tested! So I recommend thorough code review by experienced Python/Django developers before merging.
Problem
The
is_reviewedflag exhibited inconsistent behavior:is_reviewedas true when database value was falseis_reviewed = falseremained publicly accessible despite review settingsRoot Cause Analysis
is_reviewedfield was completely removed from forms for non-editors usingself.fields.pop("is_reviewed"), causing frontend display inconsistenciesis_reviewedvia API, thelistablefield wasn't included inupdate_fields, so the recalculated value wasn't persisted to the databaseSolution
is_reviewedfield readonly/disabled for non-editors instead of removing it entirelylistableinupdate_fieldswhen updatingis_reviewedto ensure the recalculated value is savedTechnical Details
listablefield is recalculated in the model'ssave()method based onstate,encoding_status, andis_reviewedupdate_fields=["is_reviewed"]only persists theis_reviewedchange, ignoring the recalculatedlistablevalueis_reviewed=Falsebutlistable=True, allowing unintended public accessTesting
Request for Review
Given my limited Python/Django experience, I especially welcome feedback on:
update_fieldsparameter