Коммит 472611ad создал по автору tiagonbotelho's avatar tiagonbotelho
Просмотр файлов

checks if user already owns a project with that name and hides the Edit button if true

владелец b2d142c4
......@@ -27,7 +27,7 @@ def edit_blob_link(project = @project, ref = @ref, path = @path, options = {})
button_tag "Edit", class: "btn disabled has-tooltip btn-file-option", title: "You can only edit files when you are on a branch", data: { container: 'body' }
elsif can_edit_blob?(blob, project, ref)
link_to "Edit", edit_path, class: 'btn btn-sm'
elsif can?(current_user, :fork_project, project)
elsif can?(current_user, :fork_project, project) && !current_user.already_owns?(project)
continue_params = {
to: edit_path,
notice: edit_in_new_fork_notice,
......
......@@ -531,6 +531,10 @@ def fork_of(project)
end
end
def already_owns?(project)
!self.owned_projects.where(name: project.name).any?
end
def ldap_user?
identities.exists?(["provider LIKE ? AND extern_uid IS NOT NULL", "ldap%"])
end
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать