Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
0bbf068ac4
commit
f1174c9ec3
|
@ -227,32 +227,22 @@ class Wiki
|
|||
end
|
||||
|
||||
def create_page(title, content, format = :markdown, message = nil)
|
||||
if Feature.enabled?(:gitaly_replace_wiki_create_page, container, type: :undefined)
|
||||
with_valid_format(format) do |default_extension|
|
||||
if file_exists_by_regex?(title)
|
||||
raise_duplicate_page_error!
|
||||
end
|
||||
|
||||
capture_git_error(:created) do
|
||||
create_wiki_repository unless repository_exists?
|
||||
sanitized_path = sluggified_full_path(title, default_extension)
|
||||
repository.create_file(user, sanitized_path, content, **multi_commit_options(:created, message, title))
|
||||
repository.expire_status_cache if repository.empty?
|
||||
after_wiki_activity
|
||||
|
||||
true
|
||||
rescue Gitlab::Git::Index::IndexError
|
||||
raise_duplicate_page_error!
|
||||
end
|
||||
with_valid_format(format) do |default_extension|
|
||||
if file_exists_by_regex?(title)
|
||||
raise_duplicate_page_error!
|
||||
end
|
||||
else
|
||||
commit = commit_details(:created, message, title)
|
||||
|
||||
wiki.write_page(title, format.to_sym, content, commit)
|
||||
repository.expire_status_cache if repository.empty?
|
||||
after_wiki_activity
|
||||
capture_git_error(:created) do
|
||||
create_wiki_repository unless repository_exists?
|
||||
sanitized_path = sluggified_full_path(title, default_extension)
|
||||
repository.create_file(user, sanitized_path, content, **multi_commit_options(:created, message, title))
|
||||
repository.expire_status_cache if repository.empty?
|
||||
after_wiki_activity
|
||||
|
||||
true
|
||||
true
|
||||
rescue Gitlab::Git::Index::IndexError
|
||||
raise_duplicate_page_error!
|
||||
end
|
||||
end
|
||||
rescue Gitlab::Git::Wiki::DuplicatePageError => e
|
||||
@error_message = _("Duplicate page: %{error_message}" % { error_message: e.message })
|
||||
|
@ -395,17 +385,6 @@ class Wiki
|
|||
}
|
||||
end
|
||||
|
||||
def commit_details(action, message = nil, title = nil)
|
||||
commit_message = build_commit_message(action, message, title)
|
||||
git_user = Gitlab::Git::User.from_gitlab(user)
|
||||
|
||||
Gitlab::Git::Wiki::CommitDetails.new(user.id,
|
||||
git_user.username,
|
||||
git_user.name,
|
||||
git_user.email,
|
||||
commit_message)
|
||||
end
|
||||
|
||||
def build_commit_message(action, message, title)
|
||||
message.presence || default_message(action, title)
|
||||
end
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: gitaly_replace_wiki_create_page
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/83734
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/356983
|
||||
milestone: '15.0'
|
||||
type: undefined
|
||||
group: group::editor
|
||||
default_enabled: false
|
|
@ -540,14 +540,6 @@ RSpec.shared_examples 'wiki model' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when feature flag :gitaly_replace_wiki_create_page is disabled' do
|
||||
before do
|
||||
stub_feature_flags(gitaly_replace_wiki_create_page: false)
|
||||
end
|
||||
|
||||
it_behaves_like 'create_page tests'
|
||||
end
|
||||
end
|
||||
|
||||
describe '#update_page' do
|
||||
|
|
Loading…
Reference in New Issue