Skip to content

Feature/temporary subscription#145

Merged
danieleguido merged 31 commits intodevelopfrom
feature/temporary-subscription
May 7, 2026
Merged

Feature/temporary subscription#145
danieleguido merged 31 commits intodevelopfrom
feature/temporary-subscription

Conversation

@danieleguido
Copy link
Copy Markdown
Contributor

No description provided.

danieleguido and others added 17 commits April 21, 2026 15:23
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.
@danieleguido danieleguido marked this pull request as ready for review May 6, 2026 15:06
@danieleguido danieleguido requested a review from Copilot May 6, 2026 15:06
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.
@danieleguido danieleguido marked this pull request as draft May 7, 2026 09:19
@danieleguido danieleguido marked this pull request as ready for review May 7, 2026 09:19
@danieleguido danieleguido requested review from Copilot and removed request for Copilot May 7, 2026 09:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 32 out of 33 changed files in this pull request and generated 9 comments.

Comment thread impresso/models/userSpecialMembershipRequest.py Outdated
Comment thread impresso/management/commands/createspecialmembershiprequest.py
Comment thread impresso/management/commands/createspecialmembershiprequest.py Outdated
Comment thread impresso/admin.py Outdated
Comment thread impresso/tests/utils/tasks/test_userSpecialMembershipRequest.py Outdated
Comment thread impresso/tests/management/commands/test_createspecialmembershiprequest.py Outdated
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
@danieleguido danieleguido merged commit 8e66c9a into develop May 7, 2026
1 check passed
@danieleguido danieleguido deleted the feature/temporary-subscription branch May 7, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants