diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /app/services/post_receive_service.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'app/services/post_receive_service.rb')
-rw-r--r-- | app/services/post_receive_service.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/services/post_receive_service.rb b/app/services/post_receive_service.rb index f12e45d701a..65e6ebc17d2 100644 --- a/app/services/post_receive_service.rb +++ b/app/services/post_receive_service.rb @@ -29,6 +29,8 @@ class PostReceiveService response.add_alert_message(message) end + response.add_alert_message(storage_size_limit_alert) + broadcast_message = BroadcastMessage.current_banner_messages&.last&.message response.add_alert_message(broadcast_message) @@ -74,4 +76,19 @@ class PostReceiveService ::MergeRequests::GetUrlsService.new(project).execute(params[:changes]) end + + private + + def storage_size_limit_alert + return unless repository&.repo_type&.project? + + payload = Namespaces::CheckStorageSizeService.new(project.namespace, user).execute.payload + return unless payload.present? + + alert_level = "##### #{payload[:alert_level].to_s.upcase} #####" + + [alert_level, payload[:usage_message], payload[:explanation_message]].join("\n") + end end + +PostReceiveService.prepend_if_ee('EE::PostReceiveService') |