[Notice] Announcing the End of Demo Server [Read me]

pullrequest: remove forking project limit
- now user can fork two or more times from one original project.
@a0c4d26ca4546928e2c4bd91de364afa118fab57
--- app/controllers/PullRequestApp.java
+++ app/controllers/PullRequestApp.java
... | ... | @@ -82,13 +82,8 @@ |
82 | 82 |
Project project = Project.findByOwnerAndProjectName(userName, projectName); |
83 | 83 |
List<OrganizationUser> orgUserList = OrganizationUser.findByAdmin(UserApp.currentUser().id); |
84 | 84 |
Project forkedProject = Project.findByOwnerAndOriginalProject(destination, project); |
85 |
- |
|
86 |
- if (forkedProject != null) { |
|
87 |
- return ok(fork.render("fork", project, forkedProject, false, new Form<>(Project.class), orgUserList)); |
|
88 |
- } else { |
|
89 |
- Project forkProject = Project.copy(project, destination); |
|
90 |
- return ok(fork.render("fork", project, forkProject, true, new Form<>(Project.class), orgUserList)); |
|
91 |
- } |
|
85 |
+ Project forkProject = Project.copy(project, destination); |
|
86 |
+ return ok(fork.render("fork", project, forkProject, forkedProject, new Form<>(Project.class), orgUserList)); |
|
92 | 87 |
} |
93 | 88 |
|
94 | 89 |
private static String findDestination(String forkOwner) { |
... | ... | @@ -118,13 +113,6 @@ |
118 | 113 |
Project projectForm = forkProjectForm.get(); |
119 | 114 |
String destination = findDestination(projectForm.owner); |
120 | 115 |
Project originalProject = Project.findByOwnerAndProjectName(userName, projectName); |
121 |
- |
|
122 |
- // 이미 포크한 프로젝트가 있다면 그 프로젝트로 이동. |
|
123 |
- Project forkedProject = Project.findByOwnerAndOriginalProject(destination, originalProject); |
|
124 |
- if(forkedProject != null) { |
|
125 |
- flash(Constants.WARNING, "fork.redirect.exist"); |
|
126 |
- return redirect(routes.ProjectApp.project(forkedProject.owner, forkedProject.name)); |
|
127 |
- } |
|
128 | 116 |
|
129 | 117 |
// 포크 프로젝트 이름 중복 검사 |
130 | 118 |
if (Project.exists(destination, projectForm.name)) { |
--- app/views/git/fork.scala.html
+++ app/views/git/fork.scala.html
... | ... | @@ -1,4 +1,4 @@ |
1 |
-@(title:String, project: Project, forkProject: Project, isNew: Boolean, form: Form[Project], orgUserList:List[OrganizationUser]) |
|
1 |
+@(title:String, project: Project, forkProject: Project, forkedProject: Project, form: Form[Project], orgUserList:List[OrganizationUser]) |
|
2 | 2 |
|
3 | 3 |
@import utils.TemplateHelper._ |
4 | 4 |
@import controllers.UserApp |
... | ... | @@ -18,9 +18,9 @@ |
18 | 18 |
@project.owner / @project.name @Messages("fork") |
19 | 19 |
</h4> |
20 | 20 |
</legend> |
21 |
- @if(isNew){ |
|
22 | 21 |
<div id="helpMessage" class="well"> |
23 | 22 |
<div class="row-fluid"> |
23 |
+ @if(forkedProject == null){ |
|
24 | 24 |
<div class="pull-left"> |
25 | 25 |
<img class="img-polaroid" src="@routes.Assets.at("images/fork-pull/fork.jpg")"><br> |
26 | 26 |
</div> |
... | ... | @@ -29,9 +29,19 @@ |
29 | 29 |
<p>@Messages("fork.help.message.1")</p> |
30 | 30 |
<p>@Messages("fork.help.message.2")</p> |
31 | 31 |
</div> |
32 |
+ } else { |
|
33 |
+ <div class="help-messages center-txt"> |
|
34 |
+ <i class="ico ico-err2"></i> |
|
35 |
+ <p>@Messages("fork.already.exist")</p> |
|
36 |
+ <p> |
|
37 |
+ <strong class="vmiddle">@project.owner / @project.name</strong> |
|
38 |
+ <i class="yobicon-right vmiddle"></i> |
|
39 |
+ <a href="@routes.ProjectApp.project(forkedProject.owner, forkedProject.name)" class="vmiddle primary-txt">@forkedProject.owner / @forkedProject.name</a> |
|
40 |
+ </p> |
|
41 |
+ </div> |
|
42 |
+ } |
|
32 | 43 |
</div> |
33 | 44 |
</div> |
34 |
- |
|
35 | 45 |
<div class="control-group"> |
36 | 46 |
<label class="control-label" for="inputOwner">@Messages("project.owner")</label> |
37 | 47 |
<div class="controls"> |
... | ... | @@ -70,21 +80,6 @@ |
70 | 80 |
<a href="@routes.PullRequestApp.pullRequests(project.owner, project.name)" class="ybtn">@Messages("button.cancel")</a> |
71 | 81 |
</div> |
72 | 82 |
</div> |
73 |
- } else { |
|
74 |
- <div class="error-wrap"> |
|
75 |
- <i class="ico ico-err2"></i> |
|
76 |
- <p>@Messages("fork.already.exist")</p> |
|
77 |
- <p> |
|
78 |
- <strong class="vmiddle">@project.owner / @project.name</strong> |
|
79 |
- <i class="yobicon-right vmiddle"></i> |
|
80 |
- <a href="@routes.ProjectApp.project(forkProject.owner, forkProject.name)" class="vmiddle primary-txt">@forkProject.owner / @forkProject.name</a> |
|
81 |
- </p> |
|
82 |
- </div> |
|
83 |
- <div class="center-txt"> |
|
84 |
- <a href="@routes.ProjectApp.project(forkProject.owner, forkProject.name)" class="ybtn ybtn-info">@Messages("fork.go")</a> |
|
85 |
- <a href="@routes.PullRequestApp.pullRequests(project.owner, project.name)" class="ybtn">@Messages("button.cancel")</a> |
|
86 |
- </div> |
|
87 |
- } |
|
88 | 83 |
</fieldset> |
89 | 84 |
</form> |
90 | 85 |
</div> |
--- public/javascripts/service/yobi.project.Fork.js
+++ public/javascripts/service/yobi.project.Fork.js
... | ... | @@ -38,8 +38,6 @@ |
38 | 38 |
* initialize element variables |
39 | 39 |
*/ |
40 | 40 |
function _initElement(htOptions){ |
41 |
- htElement.welHelpMessage = $("#helpMessage"); |
|
42 |
- htElement.welHelpButton = $("#helpBtn"); |
|
43 | 41 |
htElement.welInputProjectOwner = $("#project-owner"); |
44 | 42 |
} |
45 | 43 |
|
... | ... | @@ -47,13 +45,7 @@ |
47 | 45 |
* attach event handlers |
48 | 46 |
*/ |
49 | 47 |
function _attachEvent() { |
50 |
- htElement.welHelpButton.on("click", _onHelpButtonClick); |
|
51 | 48 |
htElement.welInputProjectOwner.on("change", _onChangeProjectOwner); |
52 |
- } |
|
53 |
- |
|
54 |
- function _onHelpButtonClick(weEvt) { |
|
55 |
- weEvt.preventDefault(); |
|
56 |
- htElement.welHelpMessage.toggle(); |
|
57 | 49 |
} |
58 | 50 |
|
59 | 51 |
function _onChangeProjectOwner() { |
--- test/controllers/PullRequestAppTest.java
+++ test/controllers/PullRequestAppTest.java
... | ... | @@ -248,7 +248,9 @@ |
248 | 248 |
User currentUser = User.findByLoginId("yobi"); |
249 | 249 |
|
250 | 250 |
Map<String,String> data = new HashMap<>(); |
251 |
+ data.put("owner", "yobi"); |
|
251 | 252 |
data.put("name", "projectYobi-2"); |
253 |
+ data.put("projectScope", "PUBLIC"); |
|
252 | 254 |
|
253 | 255 |
Result result = callAction( |
254 | 256 |
controllers.routes.ref.PullRequestApp.fork(ownerLoginId, projectName), |
... | ... | @@ -257,7 +259,7 @@ |
257 | 259 |
.withFormUrlEncodedBody(data) |
258 | 260 |
); |
259 | 261 |
|
260 |
- assertThat(status(result)).isEqualTo(SEE_OTHER); |
|
262 |
+ assertThat(status(result)).isEqualTo(OK); |
|
261 | 263 |
} |
262 | 264 |
|
263 | 265 |
@Test |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?