Class: WikiPages::CreateService
- Inherits:
-
BaseService
- Object
- BaseContainerService
- BaseService
- WikiPages::CreateService
- Defined in:
- app/services/wiki_pages/create_service.rb
Instance Attribute Summary
Attributes inherited from BaseContainerService
#container, #current_user, #group, #params, #project
Instance Method Summary collapse
Methods inherited from BaseContainerService
#group_container?, #initialize, #namespace_container?, #project_container?, #project_group
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseContainerService
Instance Method Details
#event_action ⇒ Object
29 30 31 |
# File 'app/services/wiki_pages/create_service.rb', line 29 def event_action :created end |
#execute ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/wiki_pages/create_service.rb', line 5 def execute wiki = Wiki.for_container(container, current_user) page = WikiPage.new(wiki) wiki.capture_git_error(event_action) do page.create(@params) end if page.persisted? execute_hooks(page) ServiceResponse.success(payload: { page: page }) else ServiceResponse.error(message: _('Could not create wiki page'), payload: { page: page }) end end |
#external_action ⇒ Object
25 26 27 |
# File 'app/services/wiki_pages/create_service.rb', line 25 def external_action 'create' end |
#usage_counter_action ⇒ Object
21 22 23 |
# File 'app/services/wiki_pages/create_service.rb', line 21 def usage_counter_action :create end |