Frontend Forum
Preference-filtered forum with threads, nested replies, and roles.
The forum is the peer-support core. It is preference-filtered — users only see categories matching their registration preferences, including religion-gated categories.
Routes
| Route | File | Purpose |
|---|---|---|
/forum | ForumCategory.js | Categories filtered by user preferences |
/forum/:topicId | ForumTopic.js | Threads in a category: create, reply, like, edit, delete |
/forum/:topicId/discussion/:id | DiscussionDetails.js | Thread detail with nested replies, likes, image upload |
/forum/dukungan-emosional | DukunganEmosional.js | Static "Emotional Support" feed (partial) |
Preference filtering
ForumCategory.js contains filterCategoriesByPreference:
- Religion-gated categories (Islam, Kristen, Katolik, Hindu, Buddha, Konghucu) are shown only if the user selected that preference during registration.
- Non-religious categories (medical info, mental health, emotional support) are shown based on matching preferences.
- Logged-out users see only non-religious categories.
Thread lifecycle
- Edit/delete window: threads can only be edited/deleted within 15 minutes of creation (
isThread15minutesOldOrLessinForumTopic.js). - Owner-only delete — enforced by the backend (
DELETE /api/forum/threads/:idchecks author). - Image upload — 5 MB limit, multipart, stored by the backend.
Roles & verification
ForumTopic.js fetches /api/users/:id/roles for each thread author to display role badges, and shows a verified checkmark (CircleCheck from lucide) for is_verified users.
Pseudonym
Threads and replies accept use_pseudonym — when true, the user's nama_samaran (forum alias) is displayed instead of their real name.
Reusable modals
src/components/modals/ThreadModals.js provides the only extracted reusable modal components — EditThreadModal and DeleteThreadModal — used by both ForumTopic.js and DiscussionDetails.js.
WhatsApp broadcast
When a thread is created (POST /api/forum/threads), the backend fires a WhatsApp broadcast in a goroutine to all users whose preferences match the thread's category. See Backend → WhatsApp Bot.