Feature/temporary subscription#145
Merged
danieleguido merged 31 commits intodevelopfrom May 7, 2026
Merged
Conversation
Introduce a temporary approval flow for UserSpecialMembershipRequest: add STATUS_APPROVED_TEMPORARY and STATUS_REVOKED constants, include both in the status choices (with user-facing labels), and add a temporary_expires_at DateTimeField for automatic temporary approvals. Update the ChangelogEntry status typing to reflect the new possible values. These changes enable tracking of temporary approvals and subsequent revocations in requests' lifecycle.
this is a weird migration, use FAKE
Introduce a management command (checktemporarymemberships) to list special membership requests with STATUS_APPROVED_TEMPORARY (with a --dry-run flag) and add tests for it. Add a Celery beat schedule and a periodic task (revoke_expired_temporary_memberships_beat) that finds expired temporary memberships and enqueues revoke_special_membership_request for each; schedule runs hourly. Tweak createspecialmembership help text and add a unit test to ensure the beat task enqueues revocations only for expired requests.
Switch temporary special-membership revocation to be driven by a periodic celery beat job instead of scheduling per-request apply_async ETAs. Update AGENTS.md to document the new strategy. Persist temporary_expires_at in changelog entries and add a dedicated changelog append routine that avoids duplicate consecutive entries; add calculate_temporary_expiration helper. Remove inline scheduling logic from tasks and stop scheduling revocation on save/update; after-creation flow now sets STATUS_APPROVED_TEMPORARY and temporary_expires_at and relies on beat for revocation. Update tests to assert persisted state and email behavior (no apply_async ETA assertions) and adjust the management command comment accordingly.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…mpresso/impresso-user-admin into feature/temporary-subscription
If revoke_after isn't passed for a temporary-approved SpecialMembershipRequest, derive it from dataset.get_revoke_after_days with a fallback to settings.IMPRESSO_SPECIAL_MEMBERSHIP_TEMPORARY_APPROVAL_DEFAULT_DAYS. Import django.conf.settings, compute temporary_expires_at from now + revoke_after, and update the test to use get_revoke_after_days(default_days=1). Also fix a typo in the help text (subscription).
schedule every 30 min
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.
No description provided.