diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-13 21:08:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-13 21:08:47 +0300 |
commit | e689e858ede41a34b1e9132eba6a602632e6885e (patch) | |
tree | 57f173714a177a70aa6631d77f10d5628d42cd90 /app/services/wikis | |
parent | 868e4e69bba7d3ddc2bf4899ee45d6c377a8e536 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/wikis')
-rw-r--r-- | app/services/wikis/create_attachment_service.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/app/services/wikis/create_attachment_service.rb b/app/services/wikis/create_attachment_service.rb index 6ef6cbc3c12..82179459345 100644 --- a/app/services/wikis/create_attachment_service.rb +++ b/app/services/wikis/create_attachment_service.rb @@ -5,12 +5,15 @@ module Wikis ATTACHMENT_PATH = 'uploads' MAX_FILENAME_LENGTH = 255 - delegate :wiki, to: :project + attr_reader :container + + delegate :wiki, to: :container delegate :repository, to: :wiki - def initialize(*args) - super + def initialize(container:, current_user: nil, params: {}) + super(nil, current_user, params) + @container = container @file_name = clean_file_name(params[:file_name]) @file_path = File.join(ATTACHMENT_PATH, SecureRandom.hex, @file_name) if @file_name @commit_message ||= "Upload attachment #{@file_name}" @@ -51,7 +54,7 @@ module Wikis end def validate_permissions! - unless can?(current_user, :create_wiki, project) + unless can?(current_user, :create_wiki, container) raise_error('You are not allowed to push to the wiki') end end |