-
-
Notifications
You must be signed in to change notification settings - Fork 70
Testing improvements #1513
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
Testing improvements #1513
Conversation
…function & added unit test for it
b8cc3fb
to
71dc1af
Compare
…s note) as 'get' prefix is not idiomatic
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… nasty MC with develop)
…y [accessible_to]
78367d0
to
be1887c
Compare
f9d5dae
to
84638af
Compare
# Safely gets the user's trust level even if they don't have a community user | ||
# @return [Integer] user's trust level | ||
def trust_level | ||
community_user&.trust_level || 0 |
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.
Had to restore the trust_level
method on user to avoid having to explicitly check that the community user exists
c9b8584
to
527c09b
Compare
Just added a status badge to display in the README, no meaningful changes |
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.
LGTM. I'm not qualified to evaluate the workflow part but I did read through all the tests.
# @param user [User] user to check | ||
# @return [ActiveRecord::Relation<Post>] | ||
def self.accessible_to(user) | ||
(user&.at_least_moderator? ? Post : Post.undeleted).qa_only.list_includes |
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.
Non-blocking: I assume qa_only
is what we're using now. I don't know if that plays well with new post types that can be defined through the UI. Later we should come back and review that function and where it's used and make sure it still makes sense.
assert_redirected_to_sign_in | ||
end | ||
|
||
private |
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 refactoring is so much easier to read! (And presumably maintain.) Thank you.
If you have time to spare, please do check whether everything works as expected in regards to the vulnerability fix (see the PR's description for details), that's the most important part (provided you haven't already, of course) |
Now that you mention it... First, I confirmed that neither anonymous users nor insufficiently-trusted users get posts from a restricted category in their search results. That's good. But then I noticed that users who ought to be able to see the category see neither the category nor posts from it in search results. I made a category moderator-only and tested with a mod; I then made it "veteran users" and again tested with a mod and a curator. I don't know if this is because I edited a previously-open category; I'll try making a new one to see if that's different. Update: same behavior with a brand new category with access set to "moderator only". |
This turned out to be a data error (discussed in chat). It's now working for me and my moderator user gets posts from a mod-restricted category in search results, but normal users do not. |
followup for #1509
Also introduces several GitHub actions that should take us off CircleCI:
And fixes a vulnerability related to search: