System notes appear to be queried 3 times when viewing a merge request
When viewing a merge request we appear to query the same list of system notes 3 times. For example, the performance bar reports the following for https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12463:
4.674ms SELECT "notes".* FROM "notes" WHERE "notes"."noteable_id" = 3985770 AND "notes"."noteable_type" = 'MergeRequest' AND "notes"."system" = 't';
4.64ms SELECT "notes".* FROM "notes" WHERE "notes"."noteable_id" = 3985770 AND "notes"."noteable_type" = 'MergeRequest' AND "notes"."system" = 't';
2.774ms SELECT "notes".* FROM "notes" WHERE "notes"."noteable_id" = 3985770 AND "notes"."noteable_type" = 'MergeRequest' AND "notes"."system" = 't';
As a result we waste about 12 milliseconds on this.