Skip to content

Integrate Podcast Page and Collaboration Features for Telecom Actors#17

Open
GYFX35 wants to merge 1 commit intomainfrom
integrate-podcast-collaboration-12706902973914837301
Open

Integrate Podcast Page and Collaboration Features for Telecom Actors#17
GYFX35 wants to merge 1 commit intomainfrom
integrate-podcast-collaboration-12706902973914837301

Conversation

@GYFX35
Copy link
Owner

@GYFX35 GYFX35 commented Feb 14, 2026

This change integrates a new podcast/video submission feature and enhances the platform for collaboration between Telecom actors and companies.

Key enhancements include:

  • Role-based Access Control: Users can now register as 'Telecom Actor' or 'Company', granting them access to a specialized Collaboration Hub.
  • Podcast/Video Gallery: A dedicated page for viewing and submitting video podcasts, featuring automatic YouTube embedding.
  • Collaboration Hub: A central space for Telecom actors and companies to share news and podcasts, fostering better communication and resource sharing.
  • Infrastructure Improvements: Fixed existing issues in the database migration history and updated requirements to include necessary validation libraries.

PR created automatically by Jules for task 12706902973914837301 started by @GYFX35

Summary by Sourcery

Introduce podcast submissions and a collaboration hub for telecom-focused roles, along with role-based registration and supporting schema changes.

New Features:

  • Add a podcasts page with submission form and YouTube/video embedding for user-submitted media.
  • Introduce a Telecom & Company Collaboration Hub showing curated news posts and podcasts for specific user roles.
  • Extend user registration to capture a role used for gated access to collaboration features.

Enhancements:

  • Add a News content category and expose navigation links to podcasts and the collaboration hub in the main layout.

Build:

  • Include email-validator in application dependencies.

Chores:

  • Add database models and migrations for podcasts and user roles, and clean up legacy fitness/game score migration files.

- Added 'role' field to User model (Regular User, Telecom Actor, Company)
- Updated registration form to include role selection
- Created Podcast model for video submissions with YouTube embedding support
- Implemented a Collaboration Hub restricted to Telecom actors and companies
- Added 'News' category for collaborative news submissions
- Updated navigation bar with role-based visibility for the Collaboration Hub
- Fixed broken database migrations and added missing 'email-validator' dependency

Co-authored-by: GYFX35 <134739293+GYFX35@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 14, 2026

Reviewer's Guide

Adds role-based access control, a podcast submission and viewing workflow, and a dedicated collaboration hub for Telecom actors and companies, along with supporting models, forms, templates, navigation updates, and migrations.

Sequence diagram for podcast submission workflow

sequenceDiagram
    actor User
    participant WebApp
    participant PodcastForm
    participant Database

    User->>WebApp: GET /submit_podcast
    WebApp->>PodcastForm: instantiate PodcastForm
    WebApp-->>User: render submit_podcast.html with form

    User->>WebApp: POST /submit_podcast (form data)
    WebApp->>PodcastForm: validate_on_submit
    PodcastForm-->>WebApp: validation result (success)
    WebApp->>Database: INSERT Podcast (title, description, video_url, user_id)
    Database-->>WebApp: commit success
    WebApp-->>User: redirect to /podcasts

    User->>WebApp: GET /podcasts
    WebApp->>Database: SELECT podcasts ORDER BY timestamp DESC
    Database-->>WebApp: podcasts list
    WebApp-->>User: render podcasts.html with embedded videos
Loading

Sequence diagram for role-based access to collaboration hub

sequenceDiagram
    actor User
    participant WebApp
    participant CategoryModel
    participant PostModel
    participant PodcastModel
    participant Database

    User->>WebApp: GET /collaboration
    WebApp->>WebApp: check login_required
    WebApp->>WebApp: check current_user.role in [Telecom Actor, Company]
    alt unauthorized role
        WebApp-->>User: flash message and redirect to index
    else authorized role
        WebApp->>CategoryModel: query Category name=News
        CategoryModel->>Database: SELECT category News
        Database-->>CategoryModel: news_category

        WebApp->>PostModel: query posts by news_category ORDER BY id DESC
        PostModel->>Database: SELECT posts
        Database-->>PostModel: news_posts

        WebApp->>PodcastModel: query podcasts ORDER BY timestamp DESC
        PodcastModel->>Database: SELECT podcasts
        Database-->>PodcastModel: podcasts

        WebApp-->>User: render collaboration.html with news_posts and podcasts
    end
Loading

Entity relationship diagram for user roles and podcast-related tables

erDiagram
    USER {
        int id
        string username
        string email
        string role
    }

    PODCAST {
        int id
        string title
        string description
        string video_url
        date timestamp
        int user_id
    }

    FITNESS_PROGRESS {
        int id
        int user_id
        date date
        int exercises_completed
        int workout_streak
    }

    GAME_SCORE {
        int id
        int user_id
        string game
        int score
        date timestamp
    }

    USER ||--o{ PODCAST : submits
    USER ||--o{ FITNESS_PROGRESS : has
    USER ||--o{ GAME_SCORE : has
Loading

Updated class diagram for user, roles, podcast model, and forms

classDiagram
    class User {
        int id
        string username
        string email
        string role
        bool is_expert
        datetime last_message_read_time
        set_password(password)
        check_password(password)
    }

    class Podcast {
        int id
        string title
        text description
        string video_url
        datetime timestamp
        int user_id
    }

    class PodcastForm {
        string title
        text description
        string video_url
        submit()
    }

    class RegistrationForm {
        string username
        string email
        string password
        string password2
        string role
        submit()
    }

    User "1" -- "*" Podcast : podcasts
Loading

File-Level Changes

Change Details Files
Introduce role-based access control for Telecom actors and companies and surface it in registration and navigation.
  • Extend User model with a role string field and default value
  • Update registration flow to capture and persist user role via a new SelectField
  • Adjust registration template to render role selection with validation errors
  • Guard the collaboration route by checking the current user role and flashing/redirecting on unauthorized access
  • Show Collaboration Hub navigation link only when the current user role is Telecom Actor or Company
app/models.py
app/forms.py
app/routes.py
templates/register.html
templates/base.html
migrations/versions/097928f42acb_add_podcast_and_user_roles.py
Add podcast model, submission flow, and listing page including basic YouTube embedding.
  • Define Podcast model with title, description, video URL, timestamp, and relationship to User
  • Create PodcastForm for input validation and rendering of podcast submission fields
  • Add /podcasts route to list podcasts ordered by timestamp
  • Add /submit_podcast route (login required) to handle podcast creation via form and persist to DB
  • Implement podcasts listing template with conditional YouTube iframe embedding or fallback link
  • Implement submit podcast template with standard Flask-WTF error handling
app/models.py
app/forms.py
app/routes.py
templates/podcasts.html
templates/submit_podcast.html
templates/collaboration.html
migrations/versions/097928f42acb_add_podcast_and_user_roles.py
Create a collaboration hub for Telecom actors and companies that aggregates news posts and podcasts.
  • Seed a News category alongside existing seed categories during index initialization
  • Add /collaboration route (login required) that restricts access to Telecom Actor and Company roles
  • Within the collaboration view, query News posts and podcasts ordered by recency and pass them to the template
  • Build collaboration template sections for News and Podcast collaboration, linking to existing submission flows
app/routes.py
templates/collaboration.html
Update infrastructure and migrations to align DB schema and dependencies with new models and cleanup older migrations.
  • Create Alembic migration that adds podcast table, user.role column, and (re-)introduces fitness_progress and game_score tables with indexes
  • Remove superseded migrations that separately added fitness_progress and game_score models
  • Add email-validator dependency required by WTForms/Flask-WTF for email validation
migrations/versions/097928f42acb_add_podcast_and_user_roles.py
migrations/versions/d966903152ed_add_game_score_model.py
migrations/versions/f666ce65e096_add_fitness_progress_model.py
requirements.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 3 issues, and left some high level feedback:

  • The new role field is nullable in the migration and defaults to None for existing users, but the app logic assumes it’s set (e.g., navbar links, /collaboration access checks); consider backfilling a default role in the migration and/or guarding against None in template/route checks.
  • The /collaboration route assumes a News category always exists and will fail if news_category is None; add a fallback (e.g., conditional filter or guard clause) so the page still works when the category is missing or hasn’t been seeded.
  • The new migration 097928f42acb introduces fitness_progress and game_score tables while deleting their original migrations, which mixes unrelated schema changes and may complicate DB history; consider keeping these concerns in separate, incremental migrations instead of bundling them into this feature.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `role` field is nullable in the migration and defaults to `None` for existing users, but the app logic assumes it’s set (e.g., navbar links, `/collaboration` access checks); consider backfilling a default role in the migration and/or guarding against `None` in template/route checks.
- The `/collaboration` route assumes a `News` category always exists and will fail if `news_category` is `None`; add a fallback (e.g., conditional filter or guard clause) so the page still works when the category is missing or hasn’t been seeded.
- The new migration `097928f42acb` introduces `fitness_progress` and `game_score` tables while deleting their original migrations, which mixes unrelated schema changes and may complicate DB history; consider keeping these concerns in separate, incremental migrations instead of bundling them into this feature.

## Individual Comments

### Comment 1
<location> `app/routes.py:189-190` </location>
<code_context>
+    if current_user.role not in ['Telecom Actor', 'Company']:
+        flash('This page is reserved for Telecom actors and companies.')
+        return redirect(url_for('index'))
+    news_category = Category.query.filter_by(name='News').first()
+    news_posts = Post.query.filter_by(category=news_category).order_by(Post.id.desc()).all()
+    podcasts = Podcast.query.order_by(Podcast.timestamp.desc()).all()
+    return render_template('collaboration.html', title='Collaboration Hub', news_posts=news_posts, podcasts=podcasts)
</code_context>

<issue_to_address>
**issue (bug_risk):** Guard against missing 'News' category when querying posts.

If the 'News' category doesn’t exist (e.g., seeding failed or the name changed), `news_category` will be `None` and this query will instead return posts with `category == None`, which is probably incorrect. Consider explicitly handling the `None` case (e.g., return an empty list or raise) rather than relying on this fallback.
</issue_to_address>

### Comment 2
<location> `templates/podcasts.html:14` </location>
<code_context>
+            <p>{{ podcast.description }}</p>
+            <div class="video-container">
+                {% if 'youtube.com' in podcast.video_url or 'youtu.be' in podcast.video_url %}
+                    {% set video_id = podcast.video_url.split('v=')[-1] if 'v=' in podcast.video_url else podcast.video_url.split('/')[-1] %}
+                    <iframe width="560" height="315" src="https://www.youtube.com/embed/{{ video_id }}" frameborder="0" allowfullscreen></iframe>
+                {% else %}
</code_context>

<issue_to_address>
**issue (bug_risk):** Make YouTube video ID extraction more robust against query parameters.

For URLs like `https://www.youtube.com/watch?v=ID&feature=youtu.be` or `https://youtu.be/ID?si=xyz`, this will set `video_id` to include query parameters, breaking the embed URL. Please strip everything after `&`/`?`, or use a small helper to parse and keep only the actual video ID.
</issue_to_address>

### Comment 3
<location> `migrations/versions/097928f42acb_add_podcast_and_user_roles.py:58-59` </location>
<code_context>
+    with op.batch_alter_table('podcast', schema=None) as batch_op:
+        batch_op.create_index(batch_op.f('ix_podcast_timestamp'), ['timestamp'], unique=False)
+
+    with op.batch_alter_table('user', schema=None) as batch_op:
+        batch_op.add_column(sa.Column('role', sa.String(length=20), nullable=True))
+
+    # ### end Alembic commands ###
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Align `user.role` migration nullability/default with the model definition.

The model uses `role = db.Column(db.String(20), default="Regular User")`, but this migration creates a nullable column with no server default, so existing rows will get `NULL` and diverge from the model’s expected default. Please either set a `server_default` (and backfill existing rows) or make the column non-nullable after updating data so the DB matches the application’s expectations.

```suggestion
    with op.batch_alter_table('user', schema=None) as batch_op:
        batch_op.add_column(
            sa.Column(
                'role',
                sa.String(length=20),
                nullable=False,
                server_default='Regular User',
            )
        )
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +189 to +190
news_category = Category.query.filter_by(name='News').first()
news_posts = Post.query.filter_by(category=news_category).order_by(Post.id.desc()).all()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Guard against missing 'News' category when querying posts.

If the 'News' category doesn’t exist (e.g., seeding failed or the name changed), news_category will be None and this query will instead return posts with category == None, which is probably incorrect. Consider explicitly handling the None case (e.g., return an empty list or raise) rather than relying on this fallback.

<p>{{ podcast.description }}</p>
<div class="video-container">
{% if 'youtube.com' in podcast.video_url or 'youtu.be' in podcast.video_url %}
{% set video_id = podcast.video_url.split('v=')[-1] if 'v=' in podcast.video_url else podcast.video_url.split('/')[-1] %}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Make YouTube video ID extraction more robust against query parameters.

For URLs like https://www.youtube.com/watch?v=ID&feature=youtu.be or https://youtu.be/ID?si=xyz, this will set video_id to include query parameters, breaking the embed URL. Please strip everything after &/?, or use a small helper to parse and keep only the actual video ID.

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.

1 participant