Skip to content

feat(governance): add appeal and review flow for auto-suspended content - #422

Merged
3m1n3nc3 merged 1 commit into
geevapp:mainfrom
Birdmannn:main
Jul 29, 2026
Merged

feat(governance): add appeal and review flow for auto-suspended content#422
3m1n3nc3 merged 1 commit into
geevapp:mainfrom
Birdmannn:main

Conversation

@Birdmannn

Copy link
Copy Markdown
Contributor

Description

feat(governance): appeal & restore workflow for suspended content

Closes #412

What

Adds a documented recovery path for content that was auto-suspended by coordinated or mistaken flagging.

Changes

governance.rs

  • file_appeal(user, target_id) — creator-only entrypoint that transitions Suspended → UnderAppeal for both Giveaways and HelpRequests. Emits ContentAppealed.

admin.rs

  • resolve_appeal(target_id, restore) — admin-only entrypoint. restore=true returns content to Active/Open; restore=false confirms the suspension. Emits AppealResolved.

types.rs

  • GiveawayStatus::UnderAppeal and HelpRequestStatus::UnderAppeal variants (already present, wired up by the above).

test.rs

12 new governance tests covering the full appeal lifecycle, plus a fix for a pre-existing HelpRequest struct initializer missing created_at / expires_at.

Policy

Rule Behaviour
Who can appeal Content creator only (NotCreator otherwise)
Valid appeal window Content must be Suspended (InvalidStatus otherwise)
Who can resolve Admin only (panics for anyone else)
Flag history on restore Preserved — count is not reset, preventing immediate re-suspension from the same flaggers
Re-suspension after restore Allowed — fresh unique flaggers can still reach the threshold

Tests (97 passing, 0 failing)

  • Creator appeal transitions status to UnderAppeal (Giveaway + HelpRequest)
  • Non-creator appeal returns NotCreator
  • Appeal on non-suspended content returns InvalidStatus
  • Admin restore sets status back to Active / Open
  • Admin denial keeps status Suspended
  • Unauthorized resolve_appeal panics
  • Flag count is preserved after restore
  • Restored content can be re-suspended by new unique flaggers
  • ContentAppealed and AppealResolved events are emitted

Checklist

  • I have tested my changes locally
  • I have updated documentation as needed
  • I have run npx prisma generate after schema changes
  • I have run npx prisma migrate dev or npx prisma migrate deploy as appropriate

Post-Merge Steps for Maintainers

If this PR includes changes to the Prisma schema:

  1. Run the following command to apply the migration to your database:

    npx prisma migrate deploy

    or, for local development:

    npx prisma migrate dev
  2. Ensure your CI pipeline runs the migration before tests (add this step if missing):

    - name: Run Prisma Migrate
      run: npx prisma migrate deploy
  3. Make sure the database user in CI has permission to run migrations.


If you have any questions, please comment on this PR.

@3m1n3nc3
3m1n3nc3 merged commit 689e66a into geevapp:main Jul 29, 2026
2 checks passed
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.

[Governance] Add appeal and review flow for auto-suspended content

2 participants