diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/controllers/concerns/wiki_actions.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/controllers/concerns/wiki_actions.rb')
-rw-r--r-- | app/controllers/concerns/wiki_actions.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/concerns/wiki_actions.rb b/app/controllers/concerns/wiki_actions.rb index a5182000f5b..5b953fe37d6 100644 --- a/app/controllers/concerns/wiki_actions.rb +++ b/app/controllers/concerns/wiki_actions.rb @@ -8,6 +8,8 @@ module WikiActions extend ActiveSupport::Concern included do + before_action { respond_to :html } + before_action :authorize_read_wiki! before_action :authorize_create_wiki!, only: [:edit, :create] before_action :authorize_admin_wiki!, only: :destroy @@ -65,6 +67,8 @@ module WikiActions @ref = params[:version_id] @path = page.path + Gitlab::UsageDataCounters::WikiPageCounter.count(:view) + render 'shared/wikis/show' elsif file_blob send_blob(wiki.repository, file_blob) @@ -107,14 +111,16 @@ module WikiActions # rubocop:disable Gitlab/ModuleWithInstanceVariables def create - @page = WikiPages::CreateService.new(container: container, current_user: current_user, params: wiki_params).execute + response = WikiPages::CreateService.new(container: container, current_user: current_user, params: wiki_params).execute + @page = response.payload[:page] - if page.persisted? + if response.success? redirect_to( wiki_page_path(wiki, page), notice: _('Wiki was successfully updated.') ) else + flash[:alert] = response.message render 'shared/wikis/edit' end rescue Gitlab::Git::Wiki::OperationError => e |