N+1 queries for `user_notes_count` in Issues / MergeRequests API
The notes count is already computed in IssuableMetadata
(https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/issuable_metadata.rb#L22) together with the downvotes and upvotes to prevent N+1 queries.
But this count is not being used in the IssueBasic
and MergeRequestBasic
entities. The code here should be similar to the upvotes / downvotes where it gets the data from issuable_metadata
if available.