Skip to content

Add challenge forums with discussion threads and moderation#47

Merged
prazgaitis merged 3 commits intomainfrom
claude/add-challenge-forums-CMZ3n
Feb 18, 2026
Merged

Add challenge forums with discussion threads and moderation#47
prazgaitis merged 3 commits intomainfrom
claude/add-challenge-forums-CMZ3n

Conversation

@prazgaitis
Copy link
Copy Markdown
Owner

Summary

Adds a complete forum system for challenges, enabling users to create discussion threads, reply to posts, upvote content, and allowing admins to moderate by pinning/deleting posts. Includes rich activity link rendering within forum content.

Features

  • Forum Posts: Top-level posts with titles and replies without titles
  • Upvoting: Users can upvote posts and replies with toggle functionality
  • Moderation: Challenge creators and global admins can pin important posts and soft-delete content
  • Rich Content: Activity links in forum posts render as interactive cards
  • Admin Dashboard: Dedicated forum management page for moderation with post listing and bulk actions
  • Pagination: Forum listing supports paginated loading of posts

Data Model

  • forumPosts table: Stores posts/replies with soft-delete support via deletedAt field
  • forumPostUpvotes table: Tracks user upvotes with unique constraint per user+post

Backend (Convex)

  • Queries:
    • listByChallenge: Paginated forum posts (pinned first, then by date)
    • getById: Single post with replies and upvote data
    • listForAdmin: All posts including deleted (for moderation)
  • Mutations:
    • create: Create top-level posts or replies (requires challenge participation)
    • update: Edit posts (author or admin only)
    • remove: Soft-delete posts (author or admin only)
    • toggleUpvote: Add/remove upvotes
    • togglePin: Pin/unpin posts (challenge creator or global admin only)

Frontend

  • Forum listing page with new post dialog
  • Post detail page with reply thread
  • Admin forum management dashboard
  • Activity link card component for rich content rendering
  • Upvote buttons with visual feedback

Testing

  • Added comprehensive test suite (795 lines) covering:
    • Post creation (top-level and replies)
    • Validation (empty content, missing titles, non-participants)
    • Authorization (author/admin-only operations)
    • Upvoting (toggle, multiple users)
    • Pinning (creator/admin permissions)
    • Deletion (soft-delete, authorization)
    • Edge cases (deleted posts, parent validation)
  • pnpm lint
  • pnpm typecheck

Notes

  • Posts use soft-delete pattern (deletedAt timestamp) for data preservation
  • Challenge creators have admin privileges in their challenge forums
  • Global admins can moderate any forum
  • Pagination defaults to 20 items per page, configurable on load more

https://claude.ai/code/session_01VSxTbCbBXb2TcXYVDtdjJj

- Add forumPosts and forumPostUpvotes tables to Convex schema
- Backend queries: list posts (paginated, pinned first), get post detail with replies
- Backend mutations: create/update/delete posts, toggle upvote, toggle pin (admin only)
- Forum list page at /challenges/[id]/forum with new post dialog
- Post detail page with replies, upvoting, and activity link rich cards
- Admin forum management page at /challenges/[id]/admin/forum (pin/delete)
- Forum link added to dashboard nav and admin panel navigation
- 24 automated tests covering CRUD, auth, upvotes, pinning, and edge cases

https://claude.ai/code/session_01VSxTbCbBXb2TcXYVDtdjJj
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
march-fitness-2025 Ready Ready Preview, Comment Feb 18, 2026 5:19am

Request Review

@prazgaitis prazgaitis merged commit 183d5d5 into main Feb 18, 2026
4 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.

2 participants