-
Notifications
You must be signed in to change notification settings - Fork 791
AO3-5550 AO3-6022 Hide restricted works from guests and hidden works from everyone on the Related Works page #5818
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
Open
slavalamp
wants to merge
11
commits into
otwcode:master
Choose a base branch
from
slavalamp:AO3-6022_hide_hidden_related_works
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2afa5c1
AO3-6022 don't show hidden related works on related work pages
slavalamp 981235f
AO3-6022 a hacky way to make it also work in tests
slavalamp e579e38
AO3-6022 refactored + sidebar counts should also be correct in tests
slavalamp e311a70
Merge branch 'master' into AO3-6022_hide_hidden_related_works
slavalamp c16f8cb
Merge branch 'master' into AO3-6022_hide_hidden_related_works
slavalamp fb05ddf
AO3-6022 hide hidden works from everyone
slavalamp 28cddbb
AO3-6022 add comment + slightly rearrange the scopes
slavalamp 047be41
AO3-5550 hide relations that include restricted works from guests
slavalamp 60aa302
AO3-6022 rubocop
slavalamp b26e0be
AO3-6022 test improvements
slavalamp 2020187
AO3-6022 ...undo the changes that i'm already doing in the other pr a…
slavalamp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| module RelatedWorksHelper | ||
| def related_works_count(user) | ||
| related_works = user.related_works.visible_on_user_page(user).visible_works | ||
| parent_work_relationships = user.parent_work_relationships.visible_on_user_page(user) | ||
| local_parent_work_relationships = parent_work_relationships.of_visible_local_works | ||
| external_parent_work_relationships = parent_work_relationships.of_visible_external_works | ||
|
|
||
| return related_works.count + local_parent_work_relationships.count + external_parent_work_relationships.count | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
any code style/structure improvement suggestions are extremely welcome in this pr, and if anyone knows why this happens and if tests could be made work without splitting regular and external works into different scopes, that'd be great