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 non-authorized teachers to view CSF teacher markdown #13947
Conversation
CSF doesn't have cohorts, so we can't validate teacher accounts.
else | ||
false | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
return true if current_user.try(:authorized_teacher?)
return @script.k5_course? || @script.k5_draft_course? if current_user.try(:teacher?)
false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, why? I think it's clearer as written.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep as-is, if you prefer it as-is, my preference isn't that strong.
|
||
stubs(:current_user).returns(@student) | ||
refute can_view_teacher_markdown? | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is (EDIT: looks like) three different tests. Please make it three different tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the third test depends on @script.stubs(:k5_course?).returns(true)
from line 1143. I can separate these into two tests if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how much value there is in a refute can_view_teacher_markdown?
standalone test. The goal here is to verify initial assumptions for the rest of the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That standalone test would be testing that users who aren't logged in can't see teacher markdown. If I make a change to can_view_teacher_markdown?
that screws up the logic for logged-out users, but it still works correctly for non-authorized teachers, it would be nice if this test case kept passing but a separate logged out users can't see teacher markdown
test failed.
LGTM |
PTAL |
CSF doesn't have cohorts, so we can't validate teacher accounts. Confirming with @ryansloan, is this what you expected?