diff options
author | Robert Speicher <robert@gitlab.com> | 2016-05-02 17:18:22 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-05-02 17:18:22 +0000 |
commit | 0652d92526cb504be076c059f76360b4c876135b (patch) | |
tree | 67ce35fafee4e5b77b802ad44f87560fd7cbb91d /app | |
parent | 819076efe136e86dddba4801a85bc750dc521a69 (diff) | |
parent | f1e74de47cd9fcf334617023aaa737c83c98a7f2 (diff) | |
download | gitlab-ce-0652d92526cb504be076c059f76360b4c876135b.tar.gz |
Merge branch '15527-fix-wiki-page-creation-issue' into 'master'
Fix error when trying to create a wiki page
Closes #15527, #15569, #15623, #15630, #15637, #15653, #15870, #16558, #16875, #16987, #17016, https://github.com/gitlabhq/gitlabhq/issues/10317.
See merge request !3924
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/wikis_controller.rb | 4 | ||||
-rw-r--r-- | app/services/wiki_pages/create_service.rb | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index c02bc28acef..0d6c32fabd2 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -40,10 +40,10 @@ class Projects::WikisController < Projects::ApplicationController end def update - @page = @project_wiki.find_page(params[:id]) - return render('empty') unless can?(current_user, :create_wiki, @project) + @page = @project_wiki.find_page(params[:id]) + if @page = WikiPages::UpdateService.new(@project, current_user, wiki_params).execute(@page) redirect_to( namespace_project_wiki_path(@project.namespace, @project, @page), diff --git a/app/services/wiki_pages/create_service.rb b/app/services/wiki_pages/create_service.rb index 988c663b9d0..24a817c06c9 100644 --- a/app/services/wiki_pages/create_service.rb +++ b/app/services/wiki_pages/create_service.rb @@ -1,7 +1,8 @@ module WikiPages class CreateService < WikiPages::BaseService def execute - page = WikiPage.new(@project.wiki) + project_wiki = ProjectWiki.new(@project, current_user) + page = WikiPage.new(project_wiki) if page.create(@params) execute_hooks(page, 'create') |