Skip to content

Conversation

@sanchitmalhotra126
Copy link
Contributor

Minor cleanup to the get_or_create_for_level projects API that I noticed during HoAI work: previously we were passing in the scriptLevelId to this API because we used it in conjunction with a provided user ID to verify if the current user had permission to view the given user's project on this level. However, the can?(:view_as_user) function that receives the script level ID only actually uses it for code review-specific scenarios, and otherwise just checks if the given user is a student of the current user. Since the latter conditions is all we care about, we can skip checking the script level ID which simplifies logic in this controller action and simplifies downstream API and function calls.

Testing story

Tested locally that teacher view student work still works as expected, and otherwise users cannot access projects of other users that are not their students.

@sanchitmalhotra126 sanchitmalhotra126 requested review from a team, breville and molly-moen January 5, 2026 20:50
Copy link
Contributor

@molly-moen molly-moen left a comment

Choose a reason for hiding this comment

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

Nice!

@sanchitmalhotra126 sanchitmalhotra126 merged commit 2398512 into staging Jan 7, 2026
6 checks passed
@sanchitmalhotra126 sanchitmalhotra126 deleted the sanchit/script-level-id-cleanup branch January 7, 2026 17:26
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