Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 14:59:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-12-17 14:59:07 +0300
commit8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch)
tree544930fb309b30317ae9797a9683768705d664c4 /app/presenters/project_presenter.rb
parent4b1de649d0168371549608993deac953eb692019 (diff)
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'app/presenters/project_presenter.rb')
-rw-r--r--app/presenters/project_presenter.rb23
1 files changed, 10 insertions, 13 deletions
diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb
index 0f5b601f2b0..55b550d8544 100644
--- a/app/presenters/project_presenter.rb
+++ b/app/presenters/project_presenter.rb
@@ -77,19 +77,19 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
end
def readme_path
- filename_path(:readme)
+ filename_path(repository.readme_path)
end
def changelog_path
- filename_path(:changelog)
+ filename_path(repository.changelog&.name)
end
def license_path
- filename_path(:license_blob)
+ filename_path(repository.license_blob&.name)
end
def ci_configuration_path
- filename_path(:gitlab_ci_yml)
+ filename_path(repository.gitlab_ci_yml&.name)
end
def contribution_guide_path
@@ -244,11 +244,11 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
end
def readme_anchor_data
- if current_user && can_current_user_push_to_default_branch? && repository.readme.nil?
+ if current_user && can_current_user_push_to_default_branch? && readme_path.nil?
AnchorData.new(false,
statistic_icon + _('Add README'),
empty_repo? ? add_readme_ide_path : add_readme_path)
- elsif repository.readme
+ elsif readme_path
AnchorData.new(false,
statistic_icon('doc-text') + _('README'),
default_view != 'readme' ? readme_path : '#readme',
@@ -397,13 +397,10 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
current_user && can?(current_user, :create_cluster, project)
end
- def filename_path(filename)
- if blob = repository.public_send(filename) # rubocop:disable GitlabSecurity/PublicSend
- project_blob_path(
- project,
- tree_join(default_branch, blob.name)
- )
- end
+ def filename_path(filepath)
+ return if filepath.blank?
+
+ project_blob_path(project, tree_join(default_branch, filepath))
end
def anonymous_project_view