-
Notifications
You must be signed in to change notification settings - Fork 441
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
WIP: Always use backend response for requests to source/:project_name #16955
base: master
Are you sure you want to change the base?
Conversation
end | ||
|
||
def render_project_issues | ||
set_issues_defaults | ||
render partial: 'source/project_issues', formats: [:xml] | ||
end | ||
|
||
def render_project_packages | ||
@packages = params.key?(:expand) ? @project.expand_all_packages : @project.packages.pluck(:name) |
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.
the expand
parameter can be handled by the backend as well
Set back to WIP since the minitests indicated some gaps... |
f8f5d12
to
43aca1c
Compare
# This implicitly also checks if the user can access the project (for hidden projects). | ||
# We have to make sure to initialize the project already at this | ||
# point, even we dont need the object in most cases because of that fact. | ||
# TODO: Don't implicitly use the finder logic to authorize! |
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.
513e531
to
cab76c6
Compare
Right now we use the presence of the `?deleted=0` query parameter as a workaround to force the request being passed directly to the backend and returning results based on backend data over returning results based on frontend database entries. This workaround currently leads to inconsistant results being returned by the API. Instead of using this workaround we better should always let the backend handle the request (where possible) and return the data based on it's info. Fixes openSUSE#16911
In this case we want the return to avoid double render errors.
After changing the `source/:project_name` to always pass the request to the backend, the `count` attribute is not longer part of the `directory` tag. This was only included by the frontend.
Since we now always get the info from the backend on `source/:project_name` the multibuild flavors are included as well. We have to skip those when querying for `source/:project_name/:package_name/_meta` since multibuild flavors dont have their own meta file.
cab76c6
to
6a64e22
Compare
After creating package along the test, the frontend knows only about what exists in the fixtures (db) instead, but the backend still has the created package
return | ||
end | ||
|
||
render_project_packages | ||
raise InvalidParameterError, "'#{params[:view]}' is not a valid 'view' parameter value." unless params[:view].in?(%w[verboseproductlist productlist issues info]) |
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.
Where do we show this message?
packages.elements('entry') do |p| | ||
# skip multibuild flavors | ||
next if p['name'].include?(':') |
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.
Try to use functional approaches when possible. It moves out the complexity from inside each iteration:
packages.elements('entry') do |p| | |
# skip multibuild flavors | |
next if p['name'].include?(':') | |
packages.elements('entry').reject {|p| p['name'].include?(':') }.each do |p| |
Right now we use the presence of the
?deleted=0
query parameteras a workaround to force the request being passed directly to the
backend and returning results based on backend data over returning
results based on frontend database entries.
This workaround currently leads to inconsistant results being returned
by the API.
Instead of using this workaround we better should always
let the backend handle the request (where possible) and return
the data based on it's info.
Fixes #16911
Replaces #16928
So in short, after introducing this change we always deliver what
?delete=0
was doing before.