Skip to content

Add privacy checks for profile links in course detail page#705

Merged
A1L13N merged 3 commits intomainfrom
copilot/update-course-detail-page
Dec 15, 2025
Merged

Add privacy checks for profile links in course detail page#705
A1L13N merged 3 commits intomainfrom
copilot/update-course-detail-page

Conversation

Copy link
Contributor

Copilot AI commented Oct 8, 2025

Problem

When viewing a course detail page, profile links were displayed for both teachers and students regardless of their privacy settings. Clicking on a link to a private profile would result in a 404 error, creating a poor user experience.

Solution

This PR adds privacy checks before displaying profile links in the course detail page:

Changes Made

  1. Teacher Profile Link (lines 217-223)

    • Added conditional check {% if course.teacher.profile.is_profile_public %} before rendering the "View Profile" button
    • Only users with public profiles will have their profile link displayed
  2. Student Profile Links in Enrollments Table (lines 852-858)

    • Added conditional check {% if enrollment.student.profile.is_profile_public %} before rendering the profile icon link
    • Prevents students with private profiles from having clickable profile links in the course enrollments table

Example

Before: All users had "View Profile" links, even those with private profiles

<a href="{% url 'public_profile' course.teacher.username %}">
  <i class="fas fa-user mr-2"></i>
  View Profile
</a>

After: Profile links only shown for public profiles

{% if course.teacher.profile.is_profile_public %}
  <a href="{% url 'public_profile' course.teacher.username %}">
    <i class="fas fa-user mr-2"></i>
    View Profile
  </a>
{% endif %}

Related Issue

This is a subset of the changes from PR #622, specifically keeping only the course detail page modifications as requested.

Testing

  • Template passes djlint formatting checks
  • Privacy logic correctly hides profile links when is_profile_public is False
  • UI remains intact for public profiles
Original prompt

just keep the changes to course detail page @alphaonelabs/alphaonelabs-education-website/pull/622


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com>
Copilot AI changed the title [WIP] Update course detail page layout and design Add privacy checks for profile links in course detail page Oct 8, 2025
Copilot AI requested a review from A1L13N October 8, 2025 15:41
@A1L13N A1L13N marked this pull request as ready for review October 14, 2025 14:00
@A1L13N A1L13N merged commit aa2cb2e into main Dec 15, 2025
9 of 10 checks passed
@A1L13N A1L13N deleted the copilot/update-course-detail-page branch December 15, 2025 00:46
@github-actions github-actions bot added the files-changed: 1 PR changes 1 file label Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants