[contracts] allows reissue of contracts - #14593
Open
part-avocado wants to merge 5 commits into
Open
Conversation
Generalizes the void+resend pattern that only existed for Event::Application cosigners into a consistent, self-service-capable feature: - Contract::PartyPolicy#resend? now allows the contract's own signee/organizer to re-send an unchanged invite to another non-HCB party (not just admins). The HCB party stays admin-only, and the self-service clause is a single line to drop if it needs to be restricted back to admins. - Event::Application#check_cosigner_update now voids with reissuing: true and links the new contract via reissue_of, matching the reissue chain used everywhere else instead of leaving orphaned voided contracts. - OrganizerPositionInvite gets the same "fix cosigner email and resend" action Event::Application already had (resend_to_cosigner), since it had no self-service path at all before - only an admin-only send_contract. external_service: manual contracts need no special-casing here: they're created directly in the signed state via console per dev-docs/guides/contracts.md, so they never have anything pending to resend. Addresses hackclub#14545.
send_contract reads event.airtable_record, which was hitting the real Airtable API and failing all four new specs with WebMock::NetConnectNotAllowedError.
mark_voided! calls archive_on_docuseal! (DELETE /submissions/:id), which wasn't stubbed and made the "voids and reissues" spec hit WebMock::NetConnectNotAllowedError.
…e-8bovsd Let signing parties fix a wrong cosigner email and resend contracts --- ## Changes - `Contract#owned_by?` (new) + `Contract::PartyPolicy#resend?` (broadened): the contract's own signee/organizer can now re-send an unchanged invite to another non-HCB party on their own contract, not just admins. The HCB party stays admin-only, and the self-service clause is a single line to drop if it ever needs to be restricted back to admins only. - Fixed `Event::Application#check_cosigner_update` to void with `reissuing: true` and link the new contract via `reissue_of`, matching the reissue chain used everywhere else (`ContractsController#reissue`, `Payroll::Position`), instead of leaving orphaned, unlinked voided contracts. - Added `OrganizerPositionInvite#resend_to_cosigner` (policy + controller action + route + UI modal on the invite's own show page), mirroring `Event::Application`'s existing action — it previously had no self-service cosigner-fix path, only an admin-only `send_contract`. `external_service: manual` contracts need no special-casing: per `dev-docs/guides/contracts.md` they're created directly via console already in the `signed` state, so they never have anything pending to resend — the existing void/archive guards already no-op safely for them. Added specs (`spec/policies/contract/party_policy_spec.rb`, and additions to `spec/models/contract_spec.rb` and `spec/controllers/organizer_position_invites_controller_spec.rb`) modeled on existing patterns in the repo. I wasn't able to run the suite locally in my environment, so I'm relying on this PR's CI run to confirm they pass. Closes hackclub#14545.
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 of the problem
current implementation does not allow anybody to rescind/resend forms with incorrect information, and only allows admins to void current contract
Describe your changes
Contract#owned_by?(new) +Contract::PartyPolicy#resend?(broadened): the contract's own signee/organizer can now re-send an unchanged invite to another non-HCB party on their own contract, not just admins. The HCB party stays admin-only, and the self-service clause is a single line to drop if it ever needs to be restricted back to admins only.Event::Application#check_cosigner_updateto void withreissuing: trueand link the new contract viareissue_of, matching the reissue chain used everywhere else (ContractsController#reissue,Payroll::Position), instead of leaving orphaned, unlinked voided contracts.OrganizerPositionInvite#resend_to_cosigner(policy + controller action + route + UI modal on the invite's own show page), mirroringEvent::Application's existing action — it previously had no self-service cosigner-fix path, only an admin-onlysend_contract.external_service: manualcontracts need no special-casing: perdev-docs/guides/contracts.mdthey're created directly via console already in thesignedstate, so they never have anything pending to resend as the existing void/archive guards already no-op safely for them.Added specs (
spec/policies/contract/party_policy_spec.rb, and additions tospec/models/contract_spec.rbandspec/controllers/organizer_position_invites_controller_spec.rb) modeled on existing patterns in the repo.Closes #14545.