Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 15:07:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 15:07:33 +0300
commit6b75320f525f841454f1ab162d141d3610f2e77b (patch)
tree4971c27759e4fbc18b85e71800c3b9c12346317e /app/services/event_create_service.rb
parent4226aca420920c1844e8eade4798a2dff188a6fc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/event_create_service.rb')
-rw-r--r--app/services/event_create_service.rb24
1 files changed, 15 insertions, 9 deletions
diff --git a/app/services/event_create_service.rb b/app/services/event_create_service.rb
index 395c5fe09ac..f7282c22a52 100644
--- a/app/services/event_create_service.rb
+++ b/app/services/event_create_service.rb
@@ -73,15 +73,27 @@ class EventCreateService
end
def push(project, current_user, push_data)
+ create_push_event(PushEventPayloadService, project, current_user, push_data)
+ end
+
+ def bulk_push(project, current_user, push_data)
+ create_push_event(BulkPushEventPayloadService, project, current_user, push_data)
+ end
+
+ private
+
+ def create_record_event(record, current_user, status)
+ create_event(record.resource_parent, current_user, status, target_id: record.id, target_type: record.class.name)
+ end
+
+ def create_push_event(service_class, project, current_user, push_data)
# We're using an explicit transaction here so that any errors that may occur
# when creating push payload data will result in the event creation being
# rolled back as well.
event = Event.transaction do
new_event = create_event(project, current_user, Event::PUSHED)
- PushEventPayloadService
- .new(new_event, push_data)
- .execute
+ service_class.new(new_event, push_data).execute
new_event
end
@@ -92,12 +104,6 @@ class EventCreateService
Users::ActivityService.new(current_user, 'push').execute
end
- private
-
- def create_record_event(record, current_user, status)
- create_event(record.resource_parent, current_user, status, target_id: record.id, target_type: record.class.name)
- end
-
def create_event(resource_parent, current_user, status, attributes = {})
attributes.reverse_merge!(
action: status,