-
Notifications
You must be signed in to change notification settings - Fork 86
feat(ig): Add editable IG pages with dynamic fields #2562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
- Added planning document for editable IG pages feature - Outlined schema updates and API endpoints - Ready to implement dynamic field support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a planning document for implementing editable Interest Group (IG) pages with dynamic field support. The plan outlines database schema changes, new API endpoints for managing page content and sections, and support for various content types including text, images, video embeds, and custom HTML blocks. This feature aims to give IG administrators more flexibility in customizing their Interest Group pages beyond the current static fields.
Key Changes:
- Planning document for dynamic IG page editing feature
- Proposed schema updates: JSONField for page_content and new IGPageSection model
- Four new API endpoints for CRUD operations on IG pages and sections
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - PUT /api/dashboard/ig/{id}/page/ - Update IG page content | ||
| - POST /api/dashboard/ig/{id}/sections/ - Add new section | ||
| - DELETE /api/dashboard/ig/{id}/sections/{section_id}/ - Remove section | ||
|
|
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan doesn't specify authorization requirements for the new endpoints. Based on the existing PATCH endpoint at line 291 in dash_ig_view.py which restricts updates to Admins and IG Leads, clarify who should be able to create, update, and delete page sections - should it be limited to IG Leads and Admins only, or should members have access as well?
| ### Authorization Requirements | |
| - Only IG Leads and Admins are permitted to create, update, or delete page sections via the following endpoints: | |
| - PUT /api/dashboard/ig/{id}/page/ | |
| - POST /api/dashboard/ig/{id}/sections/ | |
| - DELETE /api/dashboard/ig/{id}/sections/{section_id}/ | |
| - Regular IG members and other users have read-only access (GET endpoint only). |
| - Add `page_content` JSONField to Interest Group model | ||
| - Add `IGPageSection` model for dynamic sections | ||
|
|
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The database schema updates lack important implementation details. For the JSONField 'page_content', specify the expected schema structure and constraints. For the 'IGPageSection' model, define the fields it should contain (e.g., section_type, content, order, created_by, updated_by, timestamps). Without this information, developers implementing this feature may make inconsistent design decisions.
| - Add `page_content` JSONField to Interest Group model | |
| - Add `IGPageSection` model for dynamic sections | |
| - Add `page_content` JSONField to Interest Group model | |
| - **Expected schema:** | |
| ```json | |
| { | |
| "sections": [ | |
| { | |
| "section_type": "text" | "image" | "video" | "html", | |
| "content": string | object, // e.g., text, image URL, video embed code, or HTML | |
| "order": integer, | |
| "settings": { /* optional, e.g., style, alignment, etc. */ } | |
| } | |
| ] | |
| } | |
| ``` | |
| - **Constraints:** | |
| - `sections` is an array of section objects | |
| - Each section must have a `section_type`, `content`, and `order` | |
| - `order` is a unique integer per IG page, used for sorting | |
| - `section_type` must be one of: `"text"`, `"image"`, `"video"`, `"html"` | |
| - Add `IGPageSection` model for dynamic sections | |
| - **Fields:** | |
| - `id`: AutoField (primary key) | |
| - `interest_group`: ForeignKey to Interest Group | |
| - `section_type`: CharField (choices: `"text"`, `"image"`, `"video"`, `"html"`) | |
| - `content`: JSONField (structure depends on `section_type`) | |
| - `order`: IntegerField (for ordering sections) | |
| - `created_by`: ForeignKey to User | |
| - `updated_by`: ForeignKey to User | |
| - `created_at`: DateTimeField (auto_now_add=True) | |
| - `updated_at`: DateTimeField (auto_now=True) | |
| - **Constraints:** | |
| - `order` must be unique per Interest Group | |
| - `section_type` must be one of the allowed choices | |
| - `content` must match the expected structure for the given `section_type` |
| ### 3. Dynamic Fields Support | ||
| - Text sections | ||
| - Image sections | ||
| - Video embeds |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Video embeds should specify which platforms/domains will be allowed (e.g., YouTube, Vimeo) to prevent security risks from arbitrary embed sources. Additionally, the plan should mention using oEmbed or iframe sandboxing for safe embedding, and validating that URLs match expected patterns for approved platforms.
| - Video embeds | |
| - Video embeds (only from approved platforms: YouTube, Vimeo, etc.; embed URLs will be validated to match expected patterns; oEmbed or iframe sandboxing will be used for safe embedding) |
| - Text sections | ||
| - Image sections | ||
| - Video embeds | ||
| - Custom HTML blocks |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Custom HTML blocks pose a significant XSS (cross-site scripting) security risk. If user-generated HTML is rendered without proper sanitization, malicious scripts can be injected and executed in other users' browsers. Consider implementing HTML sanitization (e.g., using bleach library in Python or DOMPurify on the frontend) to strip potentially dangerous elements and attributes, or avoid custom HTML altogether in favor of a safer markdown format.
| - Custom HTML blocks | |
| - Custom HTML blocks (must be sanitized before rendering using a library such as bleach (Python) or DOMPurify (JS), or consider using a safer markdown format instead) |
| - GET /api/dashboard/ig/{id}/page/ - Get IG page content | ||
| - PUT /api/dashboard/ig/{id}/page/ - Update IG page content | ||
| - POST /api/dashboard/ig/{id}/sections/ - Add new section | ||
| - DELETE /api/dashboard/ig/{id}/sections/{section_id}/ - Remove section |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API endpoints lack input validation specifications. The plan should include details about validating JSONField content structure, maximum sizes for text/image sections, allowed video embed domains (to prevent embedding from untrusted sources), and restrictions on the number of sections per page to prevent abuse and ensure system stability.
Description
This PR implements editable Interest Group (IG) pages with dynamic field support.
Changes Made
Type of Change
Implementation Plan
Database Schema
page_contentJSONField to InterestGroup modelIGPageSectionmodel for dynamic sectionsAPI Endpoints
Features
Status
🚧 Work in Progress
Testing
Related Issues
None