Creator Restrictions and Course Feature APIs#479
Merged
mofeejegi merged 1 commit intoJun 7, 2026
Conversation
There was a problem hiding this comment.
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_attocoursesand introduceCourse.featured_coursesscope ordered by most recently featured. - Add public
GET /courses/featuredendpoint 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
featured_atcolumn to thecoursestable and updated the schema to support featured courses. [1] [2] [3]featured_coursesscope on theCoursemodel to easily retrieve published, active, featured courses ordered by most recently featured.feature_course) and unfeature (unfeature_course) courses, ensuring only eligible courses can be featured and supporting idempotent removal. [1] [2] [3]Improved Error Messaging for Non-Creators:
AuthController,CoursesController, andQuestionsControllerto provide clear instructions for users who are not yet creators, guiding them to the correct onboarding process. [1] [2] [3]