Skip to content

Make /issue_list/ endpoints support conditional requests#476

Merged
bpepple merged 2 commits intoMetron-Project:masterfrom
jyggen:issue-list-conditional
Mar 11, 2026
Merged

Make /issue_list/ endpoints support conditional requests#476
bpepple merged 2 commits intoMetron-Project:masterfrom
jyggen:issue-list-conditional

Conversation

@jyggen
Copy link
Copy Markdown
Contributor

@jyggen jyggen commented Mar 10, 2026

This PR make all /issue_list/ endpoints support conditional requests by using the modified field of the parent model.

Since the modified field is currently only updated when the parent model itself changes, this PR adds signals to the relevant models which updates the modified field on them when issues are added or removed to their relationship. I think this change to modified makes sense semantically since the model is modified when its relationships are changed. It's especially true for the Series model which currently will return a 304 even if the issue_count property has changed since the If-Modified-Since date due to the modified of the series not changing when an issue is added or removed.

@bpepple bpepple self-assigned this Mar 11, 2026
@bpepple bpepple added the enhancement New feature or request label Mar 11, 2026
- Fix IssueListMixin._issue_list to use self.request in serializer context instead of the (incorrectly bound) request parameter, ensuring image URLs are generated correctly
- Update update_series_modified_on_issue_save to bump the series modified timestamp on every issue save, not just on creation, so the series issue_list Last-Modified header stays accurate after issue edits
- Handle post_clear in update_related_modified so that clearing issues from a parent object (arc.issues.clear(), etc.) invalidates the parent's cached response; document that the issue-side clear remains a no-op since pk_set is None
- Add tests for post_clear behaviour (parent-side updates, issue-side is a no-op) and update test_issue_save_does_not_update_series_on_update to reflect the corrected save behaviour
- Remove unused issue_with_arc fixture from test_character_issue_list_conditional_request_returns_304
Copy link
Copy Markdown
Member

@bpepple bpepple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Made a couple of minor changes:

  • Fixed the IssueListMixin._issue_list serializer context to use self.request.
  • Modified update_series_modified_on_issue_save to update the series modified timestamp on every issue save, not just on creation, so the series issue_list Last-Modified header stays accurate after issue edits.
  • Updated post_clear in update_related_modified so that clearing issues from a parent object (arc.issues.clear(), etc.) invalidates the parent's cached response
  • Added/Updated a couple of tests.

@bpepple bpepple merged commit 1434a40 into Metron-Project:master Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants