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

Notifications GET request returns wrong "count" #726

Open
fhlavac opened this issue Jan 21, 2020 · 3 comments
Open

Notifications GET request returns wrong "count" #726

fhlavac opened this issue Jan 21, 2020 · 3 comments
Assignees

Comments

@fhlavac
Copy link

fhlavac commented Jan 21, 2020

When request sent to
/api/notifications?expand=resources&attributes=details&sort_by=id&sort_order=desc&limit=100
then in a reply (picture below) received count: 11468
image

I would expect that this value is the total notifications count of the current user but it isn't. In this case, the number of total user's notifications is 200. To get the number of total user's notifications I have to send another request. The current value of "count" is quite useless, maybe it is a bug. Would it be possible to replace it with the total number of current user's notifications?

@martinpovolny

@martinpovolny
Copy link
Member

martinpovolny commented Jan 29, 2020

Investigation notes:

In app/controllers/api/base_controller/renderer.rb collection_search applies custom "search_condition" via a call to notifications_search_conditions.

However in app/controllers/api/base_controller.rb in index a call to Api::QueryCounts.new is done with NotificationRecipient.count. That ignores any custom search condition.

So this is probably going to be broken everywhere where *_search_condition is used:

app/controllers/api/automation_requests_controller.rb
app/controllers/api/groups_controller.rb
app/controllers/api/notifications_controller.rb
app/controllers/api/provision_requests_controller.rb
app/controllers/api/reports_controller.rb
app/controllers/api/requests_controller.rb
app/controllers/api/results_controller.rb
app/controllers/api/service_orders_controller.rb
app/controllers/api/service_requests_controller.rb
app/controllers/api/tenant_groups_controller.rb

Really, I see the same issue with groups.

@miq-bot
Copy link
Member

miq-bot commented Jun 11, 2020

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the traige process documentation.

@miq-bot miq-bot added the stale label Jun 11, 2020
@gtanzillo gtanzillo added pinned and removed stale labels Jul 13, 2020
@gtanzillo
Copy link
Member

@lpichler Can you take a look at this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants