Skip to content

Creator Restrictions and Course Feature APIs#479

Merged
mofeejegi merged 1 commit into
developmentfrom
mofeejegi/featured-courses-and-creator-restrictions
Jun 7, 2026
Merged

Creator Restrictions and Course Feature APIs#479
mofeejegi merged 1 commit into
developmentfrom
mofeejegi/featured-courses-and-creator-restrictions

Conversation

@mofeejegi

Copy link
Copy Markdown
Member

This pull request introduces a new "featured courses" capability to the platform, allowing admins to curate and manage a list of highlighted courses for users. It also improves error messaging for non-creators attempting to access creator-only features. The main changes are grouped below:

Featured Courses Functionality:

  • Added a featured_at column to the courses table and updated the schema to support featured courses. [1] [2] [3]
  • Introduced a featured_courses scope on the Course model to easily retrieve published, active, featured courses ordered by most recently featured.
  • Added admin endpoints to feature (feature_course) and unfeature (unfeature_course) courses, ensuring only eligible courses can be featured and supporting idempotent removal. [1] [2] [3]
  • Added a public endpoint and controller action to list featured courses, with appropriate route and authorization skip. [1] [2] [3]

Improved Error Messaging for Non-Creators:

  • Updated error messages in AuthController, CoursesController, and QuestionsController to provide clear instructions for users who are not yet creators, guiding them to the correct onboarding process. [1] [2] [3]

Copilot AI review requested due to automatic review settings June 7, 2026 20:11
@mofeejegi mofeejegi merged commit a9f963b into development Jun 7, 2026
1 check passed
@mofeejegi mofeejegi deleted the mofeejegi/featured-courses-and-creator-restrictions branch June 7, 2026 20:12

Copilot AI left a comment

Copy link
Copy Markdown

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 adds an admin-curated “featured courses” capability (via a new featured_at timestamp on courses) along with new public/admin endpoints for listing and managing featured courses. It also changes creator-only entry points to return clearer “not a creator” errors instead of silently proceeding.

Changes:

  • Add featured_at to courses and introduce Course.featured_courses scope ordered by most recently featured.
  • Add public GET /courses/featured endpoint plus admin endpoints to feature/unfeature a course.
  • Update non-creator error messaging in creator-only flows.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
db/schema.rb Updates schema version and adds featured_at to courses.
db/migrate/20260607175212_add_featured_at_to_courses.rb Migration adding the featured_at column.
config/routes.rb Adds routes for featured courses listing and admin feature/unfeature actions.
app/models/course.rb Adds featured_courses scope.
app/controllers/courses_controller.rb Adds featured_courses action and makes it public; updates non-creator create behavior/message.
app/controllers/admin_controller.rb Adds feature_course and unfeature_course admin actions.
app/controllers/auth_controller.rb Improves non-creator error messaging for creator login.
app/controllers/questions_controller.rb Changes non-creator behavior/message when creating questions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -4,7 +4,7 @@ class CoursesController < ApplicationController
include CardTransactionHelper

before_action :default_12_page_size, only: [:index, :per_category, :enrolled_courses, :search, :my_courses, :tests, :purchased_courses, :purchased_tests, :created_courses]
end
else
# Do nothing
raise Errors::ForbiddenError.new(message: "You are not a creator. Please visit https://app.studyround.com to onboard as a creator.")
end
else
# Do nothing
raise Errors::ForbiddenError.new(message: "You are not a creator. Please visit https://app.studyround.com to onboard as a creator.")
# If the user is not a creator or admin, they cannot login here
if user.creator_status_none? && user.user_type != :admin
raise Errors::AuthenticationError.new(message: "You are not an approved creator, please use the usual StudyRound login")
raise Errors::AuthenticationError.new(message: "You are not a creator. Please visit https://app.studyround.com to onboard as a creator.")
mofeejegi added a commit that referenced this pull request Jun 7, 2026
* log auth_url properly

* Creator Restrictions and Course Feature APIs (#479)

* Restore AUTH_URL environment variable
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