Skip to content

Move snippets services to their own namespace

What does this MR do?

In this MR we have updated the existing code for snippets services so that it aligns better with the current structure:

  • We introduce a new folder app/services/snippets to contain the actions we need to support (create/update/destroy)
  • The logic from create_snippets_service.rb is now in app/services/snippets/create_service.rb
  • The logic from update_snippets_service.rb is now in app/services/snippets/update_service.rb
  • We introduce Snippets::DestroyService (which is needed later on to handle the deletion of the snippet repository)
  • Usages for the old services are updated
  • All the services now return a ServiceResponse object
  • Direct usages of snippet.destroy are now replaced by Snippets::DestroyService#execute calls
  • In case the user has the ability to destroy the snippet but the .destroy call doesn't succeed, the snippet page loads again and shows this message: Screen_Shot_2020-01-14_at_11.17.21_AM

Does this MR meet the acceptance criteria?

Conformity

Ref Issue: #39083 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports