Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow normal users to search submissions #1677

Merged
merged 3 commits into from Jan 30, 2020

Conversation

chvp
Copy link
Member

@chvp chvp commented Jan 30, 2020

Closes #1660.

@chvp chvp requested review from bmesuere and rien January 30, 2020 09:53
@chvp chvp added the bug fix label Jan 30, 2020
@chvp chvp added this to the 3.3 milestone Jan 30, 2020
Copy link
Member

@rien rien left a comment

Choose a reason for hiding this comment

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

Do we want to add a test for a normal user to search in their own exercises?

@@ -125,7 +125,7 @@ def set_submissions
end
if params[:course_id]
@course = Course.find(params[:course_id])
@course_labels = CourseLabel.where(course: @course) if @user.blank?
@course_labels = CourseLabel.where(course: @course) if @user.blank? && current_user.course_admin?(@course)
Copy link
Member

Choose a reason for hiding this comment

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

This will crash if current_user is nil (but I doubt if that will ever be the case).

Copy link
Member Author

Choose a reason for hiding this comment

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

I realized this while writing the code, but a logged out user can never see submissions.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess this callback is executed before permission checking though, so a logged out user constructing the right URL could technically trigger a crash. I'll change it.

@chvp
Copy link
Member Author

chvp commented Jan 30, 2020

Do we want to add a test for a normal user to search in their own exercises?

The only way to test this new behaviour is through system testing, the user could already do so via the API.

@chvp
Copy link
Member Author

chvp commented Jan 30, 2020

Hmm, we don't have any tests related to searching yet AFAICT, so I'll add some.

@chvp chvp force-pushed the fix/allow-normal-users-to-search-submissions branch from e61bd08 to e14e7dc Compare January 30, 2020 11:02
@chvp chvp merged commit b1b05a0 into develop Jan 30, 2020
@chvp chvp deleted the fix/allow-normal-users-to-search-submissions branch January 30, 2020 16:30
@bmesuere bmesuere added the bug Something isn't working label Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search bar isn't shown on some submission index pages if user isn't Zeus
3 participants