Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
0bbf068ac4
commit
f1174c9ec3
3 changed files with 13 additions and 50 deletions
|
@ -227,7 +227,6 @@ class Wiki
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_page(title, content, format = :markdown, message = nil)
|
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|
|
with_valid_format(format) do |default_extension|
|
||||||
if file_exists_by_regex?(title)
|
if file_exists_by_regex?(title)
|
||||||
raise_duplicate_page_error!
|
raise_duplicate_page_error!
|
||||||
|
@ -245,15 +244,6 @@ class Wiki
|
||||||
raise_duplicate_page_error!
|
raise_duplicate_page_error!
|
||||||
end
|
end
|
||||||
end
|
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
|
|
||||||
|
|
||||||
true
|
|
||||||
end
|
|
||||||
rescue Gitlab::Git::Wiki::DuplicatePageError => e
|
rescue Gitlab::Git::Wiki::DuplicatePageError => e
|
||||||
@error_message = _("Duplicate page: %{error_message}" % { error_message: e.message })
|
@error_message = _("Duplicate page: %{error_message}" % { error_message: e.message })
|
||||||
|
|
||||||
|
@ -395,17 +385,6 @@ class Wiki
|
||||||
}
|
}
|
||||||
end
|
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)
|
def build_commit_message(action, message, title)
|
||||||
message.presence || default_message(action, title)
|
message.presence || default_message(action, title)
|
||||||
end
|
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
|
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
|
end
|
||||||
|
|
||||||
describe '#update_page' do
|
describe '#update_page' do
|
||||||
|
|
Loading…
Reference in a new issue