Skip to content

feat(contracts): implement content flagging mechanism#270

Closed
Birdmannn wants to merge 338 commits intogeevapp:mainfrom
Birdmannn:feat/reporting-system
Closed

feat(contracts): implement content flagging mechanism#270
Birdmannn wants to merge 338 commits intogeevapp:mainfrom
Birdmannn:feat/reporting-system

Conversation

@Birdmannn
Copy link
Copy Markdown
Contributor

Pull Request Template

Description

What was added

types.rs

  • DataKey::FlagRecord(u64, Address) — tracks whether a specific user has flagged a specific content ID
  • DataKey::FlagCount(u64) — running tally of total flags per content ID
  • Error::AlreadyFlagged — returned when a user attempts to flag the same ID more than once

governance.rs (new)

A new GovernanceContract with three public functions:

Function Description
flag_content(env, user, target_id) Flags a content ID on behalf of user. Requires auth, rejects duplicates, increments count, emits ContentFlagged event.
get_flag_count(env, target_id) Returns the total number of flags for a given ID.
has_flagged(env, user, target_id) Returns whether a user has already flagged a given ID.

lib.rs

  • Registered the governance module and re-exported GovernanceContract / GovernanceContractClient.

Anti-spam design

Each flag is keyed by (target_id, user_address) in persistent storage. A second call from the same user on the same ID returns Error::AlreadyFlagged immediately, making spam-flagging impossible at the contract level.

Tests (test.rs)

Test Covers
test_flag_content_increments_count Count goes from 0 → 1 after a single flag
test_flag_content_multiple_users Two different users each increment the count
test_flag_content_duplicate_panics Same user flagging twice panics
test_has_flagged_returns_false_before_flag has_flagged is false before any flag
test_flag_counts_are_independent_per_id Flagging ID 1 does not affect ID 2

All 39 tests pass.


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.
this PR closes #210

Agbeleshe and others added 30 commits January 27, 2026 11:05
feat: conprehensive post creation validation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
created request modal using figma design
feat: Build modal for creating new giveaways with all required fields
… (Issue 030)

- Created MediaCarousel component with image navigation, thumbnails, and keyboard support
- Implemented comprehensive post detail page showing:
  - Creator profile section with avatar, name, and verification badge
  - Full post title and description (no truncation)
  - Category and status badges
  - Media carousel integration (if images present)
  - Stats grid (entries, likes, burns, winners)
  - Timeline section (created, ends, time remaining)
  - Share button with Web Share API and clipboard fallback
  - Edit button (only visible to post creator)
  - Entry list placeholder (ready for Issue 037)
- Created custom 404 page for invalid post IDs
- Implemented responsive design for mobile, tablet, and desktop
- Fixed Button asChild errors by restructuring Link/Button hierarchy
- All acceptance criteria met and verified
feat: implement post detail page with media carousel and 404 handling…
Closes #Creating authentication endpoints for wallet-based login-74
3m1n3nc3 and others added 26 commits March 27, 2026 15:47
…bution

Feat/file upload health contribution
Add GET /api/posts test for search, category, and sort
Emit a contract event after storage is updated in pick_winner with topics
giveaway, winner, and winner address; data is [giveaway_id, prize_amount]
as a Vec for FCM-style indexing. Single emission when the winner is final.

Made-with: Cursor
chore(contracts): emit event when winner claims prize
- Fix parse error in users.test.ts caused by apostrophe in single-quoted string
- Fix auth-credentials tests accessing the default stub authorize instead of
  the real implementation: in NextAuth v5 beta.30, Credentials() stores the
  user-provided config at .options, so authorize is at .options.authorize
The route was moved from app/api/auth/me/route.ts to (auth)/me/route.ts
in upstream main (commit 4ac1a9c). Update the test import accordingly.
- auth-credentials.test.ts: access real authorize via .options.authorize
  (NextAuth v5 beta.30 stores the user-provided config under .options;
  .authorize at the top level is always the default stub () => null)
- auth.test.ts: update import from @/app/api/auth/me/route to
  @/app/(auth)/me/route to match upstream rename (commit 4ac1a9c)
test: add coverage for auth/me, credentials, and user profile endpoints (#202)
fix: align frontend Post.type with DB enum ("help-request" → "request") (#203)
…ixes-261-262-263

fix(auth): update security and validation for issues #261, #262, #263
fix: correct username uniqueness check and field assignment in registration
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@Birdmannn Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Birdmannn Birdmannn force-pushed the feat/reporting-system branch from a0fc457 to 358e0d9 Compare March 30, 2026 03:26
@Birdmannn Birdmannn closed this Mar 30, 2026
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.

Reporting Mechanism (Flagging)