Открыть боковую панель
nt_test121
nt_project_9da4a5yt9x4b
Коммиты
472611ad
Коммит
472611ad
создал
Авг 06, 2016
по автору
tiagonbotelho
Просмотр файлов
checks if user already owns a project with that name and hides the Edit button if true
владелец
b2d142c4
Изменения
2
Скрыть пробелы
Построчно
Рядом
app/helpers/blob_helper.rb
Просмотр файла @
472611ad
...
...
@@ -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
,
...
...
app/models/user.rb
Просмотр файла @
472611ad
...
...
@@ -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.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать