Skip to content

feat: process place revocations via Gitea ticket sync in cron job#98

Draft
dadofsambonzuki wants to merge 1 commit into
masterfrom
feat/process-place-revocations
Draft

feat: process place revocations via Gitea ticket sync in cron job#98
dadofsambonzuki wants to merge 1 commit into
masterfrom
feat/process-place-revocations

Conversation

@dadofsambonzuki

Copy link
Copy Markdown
Member

Implements the two remaining tasks from #59:

Changes

src/service/gitea.rs — 4 new API functions:

  • close_issue — PATCH issue with state: "closed"
  • reopen_issue — PATCH issue with state: "open"
  • set_issue_labels — PUT to {url}/labels
  • add_issue_comment — POST to {url}/comments
  • GetIssueResponse now includes labels field for idempotency check

src/db/main/place_submission/ — new select_revoked_with_ticket_url query

src/rpc/import/sync_submitted_places.rs — main refactor:

  • Existing behavior preserved for non-revoked submissions
  • New section: iterates revoked submissions with ticket URLs, processes Gitea tickets:
    • Checks for label 904 as idempotency signal (skip if already processed)
    • If issue is open → closes it, swaps labels, adds comment
    • If issue is closed → reopens it, swaps labels
  • Runs every 10 min via cron

Design

All Gitea operations stay in the cron job for resilience — Gitea downtime won't affect admin revocations. Labels serve as the signal that processing has already occurred.

Verification

  • 458/458 tests pass
  • cargo clippy -- -D warnings clean
  • cargo fmt applied

When a place submission is revoked, the sync_submitted_places cron job now
handles the Gitea ticket lifecycle:

- Revoked before ticket closed → closes issue, swaps label 901→904, comments
- Revoked after ticket closed → reopens issue, swaps label 901→904

Uses the presence of label 904 on the Gitea issue as an idempotency signal
to avoid re-processing already-handled revocations.

Adds Gitea API functions: close_issue, reopen_issue, set_issue_labels,
add_issue_comment. Adds select_revoked_with_ticket_url DB query.

Closes #59
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.

1 participant