diff options
Diffstat (limited to 'app/services/event_create_service.rb')
-rw-r--r-- | app/services/event_create_service.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/services/event_create_service.rb b/app/services/event_create_service.rb index 7460f0df535..0b044e1679a 100644 --- a/app/services/event_create_service.rb +++ b/app/services/event_create_service.rb @@ -8,6 +8,8 @@ # EventCreateService.new.new_issue(issue, current_user) # class EventCreateService + IllegalActionError = Class.new(StandardError) + def open_issue(issue, current_user) create_record_event(issue, current_user, Event::CREATED) end @@ -80,6 +82,19 @@ class EventCreateService create_push_event(BulkPushEventPayloadService, project, current_user, push_data) end + # Create a new wiki page event + # + # @param [WikiPage::Meta] wiki_page_meta The event target + # @param [User] current_user The event author + # @param [Integer] action One of the Event::WIKI_ACTIONS + def wiki_event(wiki_page_meta, current_user, action) + return unless Feature.enabled?(:wiki_events) + + raise IllegalActionError, action unless Event::WIKI_ACTIONS.include?(action) + + create_record_event(wiki_page_meta, current_user, action) + end + private def create_record_event(record, current_user, status) |