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, #root_ancestor
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
26 27 28 |
# File 'app/services/wiki_pages/create_service.rb', line 26 def event_action :created end |
#execute ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/services/wiki_pages/create_service.rb', line 5 def execute wiki = Wiki.for_container(container, current_user) page = WikiPage.new(wiki) if page.create(@params) && page.persisted? execute_hooks(page) ServiceResponse.success(payload: { page: page }) else = page.template? ? _('Could not create wiki template') : _('Could not create wiki page') ServiceResponse.error(message: , payload: { page: page }) end end |
#external_action ⇒ Object
22 23 24 |
# File 'app/services/wiki_pages/create_service.rb', line 22 def external_action 'create' end |
#internal_event_name ⇒ Object
18 19 20 |
# File 'app/services/wiki_pages/create_service.rb', line 18 def internal_event_name 'create_wiki_page' end |