notes count in 1 query  for mr and commits

Improved https://github.com/gitlabhq/gitlabhq/pull/6704