Fix emails on push diff limit

Merged Stan Hu requested to merge (removed):fix-emails-on-push-diff-limit into master

The diff limits were not respected in the emails-on-push since the refactoring in gitlab-org/gitlab-ce!2705. This was one possible cause for customer issue described in gitlab-org/gitlab-ce#15137.

This MR also brings in the changes in !337 (closed) since they are required for this to work.