diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 04:45:44 +0300 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /lib/api/wikis.rb | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'lib/api/wikis.rb')
-rw-r--r-- | lib/api/wikis.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/api/wikis.rb b/lib/api/wikis.rb index 95afa36113c..4eba12157bd 100644 --- a/lib/api/wikis.rb +++ b/lib/api/wikis.rb @@ -83,11 +83,12 @@ module API put ':id/wikis/:slug' do authorize! :create_wiki, container - page = WikiPages::UpdateService + response = WikiPages::UpdateService .new(container: container, current_user: current_user, params: params) .execute(wiki_page) + page = response.payload[:page] - if page.valid? + if response.success? present page, with: Entities::WikiPage else render_validation_error!(page) @@ -101,11 +102,15 @@ module API delete ':id/wikis/:slug' do authorize! :admin_wiki, container - WikiPages::DestroyService + response = WikiPages::DestroyService .new(container: container, current_user: current_user) .execute(wiki_page) - no_content! + if response.success? + no_content! + else + render_api_error!(reponse.message) + end end desc 'Upload an attachment to the wiki repository' do |