-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Enable subproject filters for projects with subprojects #11674
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
Changes from 4 commits
b55eba8
9f59f78
66222a7
9c1dfe4
dff06b7
68d86bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -493,9 +493,7 @@ def _v1(self, project, version, build, filename, url, request): | |||||
# "Include subprojects", | ||||||
# f"subprojects:{project.slug}/{version.slug}", | ||||||
# ], | ||||||
] | ||||||
if version | ||||||
else [], | ||||||
], | ||||||
"default_filter": f"project:{project.slug}/{version.slug}" | ||||||
if version | ||||||
else None, | ||||||
|
@@ -514,6 +512,25 @@ def _v1(self, project, version, build, filename, url, request): | |||||
}, | ||||||
} | ||||||
|
||||||
# Show the subprojects filter on the parent project and subproject | ||||||
# TODO: Remove these queries and try to find a way to get this data | ||||||
# from the resolver, which has already done these queries. | ||||||
if project.subprojects.exists(): | ||||||
ericholscher marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
data["addons"]["search"]["filters"].append( | ||||||
[ | ||||||
"Include subprojects", | ||||||
f"subprojects:{project.slug}/{version.slug}", | ||||||
] | ||||||
) | ||||||
if project.superprojects.exists(): | ||||||
superproject = project.superprojects.first().parent | ||||||
data["addons"]["search"]["filters"].append( | ||||||
[ | ||||||
"Include subprojects", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are reading a subproject, you want to get results from sibling projects -- since subprojects don't have other subprojects, but sibling ones.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think subprojects is fine for the text here to not confuse users. If I go from a parent project to a subproject, it will be weird to have the text copy change in that case -- they are still "subprojects" in a certain sense, and I think keeping the UX the same makes it clearer. |
||||||
f"subprojects:{superproject.slug}/{version.slug}", | ||||||
] | ||||||
) | ||||||
|
||||||
# DocDiff depends on `url=` GET attribute. | ||||||
# This attribute allows us to know the exact filename where the request was made. | ||||||
# If we don't know the filename, we cannot return the data required by DocDiff to work. | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.