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 non-authorized teachers to view CSF teacher markdown #13947

Merged
merged 4 commits into from Mar 24, 2017

Conversation

joshlory
Copy link
Contributor

CSF doesn't have cohorts, so we can't validate teacher accounts. Confirming with @ryansloan, is this what you expected?

else
false
end
end
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@ryansloan
Copy link
Contributor

LGTM

@joshlory
Copy link
Contributor Author

PTAL

@joshlory joshlory merged commit 3f7b947 into staging Mar 24, 2017
@joshlory joshlory deleted the csf-teacher-markdown branch March 24, 2017 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.

None yet

4 participants