BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ceefe7fb
Commit
ceefe7fb
authored
Nov 29, 2017
by
Phil Hughes
Committed by
Winnie Hellmann
Dec 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'bvl-double-fork' into 'master'
Redirect to an already forked project if it exists See merge request gitlab-org/gitlab-ce!15653 (cherry picked from commit
fbe8dfb3
)
299c5439
Redirect to an already forked project if it exists
parent
aa11054b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
17 deletions
+48
-17
_fork_button.html.haml
app/views/projects/forks/_fork_button.html.haml
+26
-0
new.html.haml
app/views/projects/forks/new.html.haml
+1
-16
bvl-double-fork.yml
changelogs/unreleased/bvl-double-fork.yml
+5
-0
fork_spec.rb
spec/features/projects/fork_spec.rb
+16
-1
No files found.
app/views/projects/forks/_fork_button.html.haml
0 → 100644
View file @
ceefe7fb
-
avatar
=
namespace_icon
(
namespace
,
100
)
-
can_create_project
=
current_user
.
can?
(
:create_projects
,
namespace
)
-
if
forked_project
=
namespace
.
find_fork_of
(
@project
)
.bordered-box.fork-thumbnail.text-center.prepend-left-default.append-right-default.prepend-top-default.append-bottom-default.forked
=
link_to
project_path
(
forked_project
)
do
-
if
/no_((\w*)_)*avatar/
.
match
(
avatar
)
=
project_identicon
(
namespace
,
class:
"avatar s100 identicon"
)
-
else
.avatar-container.s100
=
image_tag
(
avatar
,
class:
"avatar s100"
)
%h5
.prepend-top-default
=
namespace
.
human_name
-
else
.bordered-box.fork-thumbnail.text-center.prepend-left-default.append-right-default.prepend-top-default.append-bottom-default
{
class:
(
"disabled"
unless
can_create_project
)
}
=
link_to
project_forks_path
(
@project
,
namespace_key:
namespace
.
id
),
method:
"POST"
,
class:
(
"disabled has-tooltip"
unless
can_create_project
),
title:
(
_
(
'You have reached your project limit'
)
unless
can_create_project
)
do
-
if
/no_((\w*)_)*avatar/
.
match
(
avatar
)
=
project_identicon
(
namespace
,
class:
"avatar s100 identicon"
)
-
else
.avatar-container.s100
=
image_tag
(
avatar
,
class:
"avatar s100"
)
%h5
.prepend-top-default
=
namespace
.
human_name
app/views/projects/forks/new.html.haml
View file @
ceefe7fb
...
...
@@ -14,22 +14,7 @@
%h5
.prepend-top-0.append-bottom-0.prepend-left-default.append-right-default
Click to fork the project
-
@namespaces
.
each
do
|
namespace
|
-
avatar
=
namespace_icon
(
namespace
,
100
)
-
can_create_project
=
current_user
.
can?
(
:create_projects
,
namespace
)
-
forked_project
=
namespace
.
find_fork_of
(
@project
)
-
fork_path
=
forked_project
?
project_path
(
forked_project
)
:
project_forks_path
(
@project
,
namespace_key:
namespace
.
id
)
.bordered-box.fork-thumbnail.text-center.prepend-left-default.append-right-default.prepend-top-default.append-bottom-default
{
class:
[(
"disabled"
unless
can_create_project
),
(
"forked"
if
forked_project
)]
}
=
link_to
fork_path
,
method:
"POST"
,
class:
[(
"js-fork-thumbnail"
unless
forked_project
),
(
"disabled has-tooltip"
unless
can_create_project
)],
title:
(
_
(
'You have reached your project limit'
)
unless
can_create_project
)
do
-
if
/no_((\w*)_)*avatar/
.
match
(
avatar
)
=
project_identicon
(
namespace
,
class:
"avatar s100 identicon"
)
-
else
.avatar-container.s100
=
image_tag
(
avatar
,
class:
"avatar s100"
)
%h5
.prepend-top-default
=
namespace
.
human_name
=
render
'fork_button'
,
namespace:
namespace
-
else
%strong
No available namespaces to fork the project.
...
...
changelogs/unreleased/bvl-double-fork.yml
0 → 100644
View file @
ceefe7fb
---
title
:
Correctly link to a forked project from the new fork page.
merge_request
:
15653
author
:
type
:
fixed
spec/features/projects/fork_spec.rb
View file @
ceefe7fb
require
'spec_helper'
describe
'Project fork'
do
include
ProjectForksHelper
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
...
...
@@ -24,8 +26,9 @@ describe 'Project fork' do
end
context
'master in group'
do
let
(
:group
)
{
create
(
:group
)
}
before
do
group
=
create
(
:group
)
group
.
add_master
(
user
)
end
...
...
@@ -53,5 +56,17 @@ describe 'Project fork' do
expect
(
page
).
to
have_css
(
'.fork-thumbnail'
,
count:
2
)
expect
(
page
).
to
have_css
(
'.fork-thumbnail.disabled'
)
end
it
'links to the fork if the project was already forked within that namespace'
do
forked_project
=
fork_project
(
project
,
user
,
namespace:
group
,
repository:
true
)
visit
new_project_fork_path
(
project
)
expect
(
page
).
to
have_css
(
'div.forked'
,
text:
group
.
full_name
)
click_link
group
.
full_name
expect
(
current_path
).
to
eq
(
project_path
(
forked_project
))
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment