Define actions in let so that it could be overridden
Define actions in let so that it could be overridden

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8091/diffs#note_20236356

dreampet/gitlab,mmkassem/gitlabhq,iiet/iiet-git,darkrasid/gitlabhq,LUMC/gitlabhq,openwide-java/gitlabhq,jirutka/gitlabhq,dplarson/gitlabhq,t-zuehlsdorff/gitlabhq,dreampet/gitlab,htve/GitlabForChinese,jirutka/gitlabhq,darkrasid/gitlabhq,mmkassem/gitlabhq,dplarson/gitlabhq,openwide-java/gitlabhq,htve/GitlabForChinese,stoplightio/gitlabhq,htve/GitlabForChinese,mmkassem/gitlabhq,iiet/iiet-git,mmkassem/gitlabhq,t-zuehlsdorff/gitlabhq,stoplightio/gitlabhq,dreampet/gitlab,axilleas/gitlabhq,axilleas/gitlabhq,LUMC/gitlabhq,t-zuehlsdorff/gitlabhq,stoplightio/gitlabhq,openwide-java/gitlabhq,stoplightio/gitlabhq,darkrasid/gitlabhq,openwide-java/gitlabhq,jirutka/gitlabhq,dplarson/gitlabhq,LUMC/gitlabhq,axilleas/gitlabhq,dreampet/gitlab,jirutka/gitlabhq,axilleas/gitlabhq,t-zuehlsdorff/gitlabhq,dplarson/gitlabhq,LUMC/gitlabhq,iiet/iiet-git,htve/GitlabForChinese,iiet/iiet-git,darkrasid/gitlabhq