summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-11-03 11:08:36 +0100
committerBob Van Landuyt <bob@vanlanduyt.co>2017-11-03 11:08:36 +0100
commit39d00bddc494c7f13527887e005b53431642d24c (patch)
tree0eddca2a370d8d93897a99d46960ee33ad9ba58f /app/helpers
parent5c147b6b8ef3f543f98c15ce2a54d4e3f2821303 (diff)
downloadgitlab-ce-39d00bddc494c7f13527887e005b53431642d24c.tar.gz
Make sure the settings page renders when root of a fork is deleted
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/projects_helper.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index d085c1a0e57..f48d47953e4 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -110,7 +110,15 @@ module ProjectsHelper
def remove_fork_project_message(project)
_("You are going to remove the fork relationship to source project %{forked_from_project}. Are you ABSOLUTELY sure?") %
- { forked_from_project: @project.forked_from_project.name_with_namespace }
+ { forked_from_project: fork_source_name(project) }
+ end
+
+ def fork_source_name(project)
+ if @project.fork_source
+ @project.fork_source.full_name
+ else
+ @project.fork_network&.deleted_root_project_name
+ end
end
def project_nav_tabs
@@ -140,8 +148,8 @@ module ProjectsHelper
def can_change_visibility_level?(project, current_user)
return false unless can?(current_user, :change_visibility_level, project)
- if project.forked?
- project.forked_from_project.visibility_level > Gitlab::VisibilityLevel::PRIVATE
+ if project.fork_source
+ project.fork_source.visibility_level > Gitlab::VisibilityLevel::PRIVATE
else
true
end