[Notice] Announcing the End of Demo Server [Read me]
milestone: Fix attachment bug and creation with no contents
See: Yona Github issue #123
@fea9fcc078a7e1f4f4496b9cf0f1a5c54cb60af6
--- app/controllers/AbstractPostingApp.java
+++ app/controllers/AbstractPostingApp.java
... | ... | @@ -249,7 +249,7 @@ |
249 | 249 |
return AttachmentApp.TEMPORARYFILES_KEEPUP_TIME_MILLIS/(60*1000l); |
250 | 250 |
} |
251 | 251 |
|
252 |
- private static String[] getTemporaryFileListFromHiddenForm() { |
|
252 |
+ public static String[] getTemporaryFileListFromHiddenForm() { |
|
253 | 253 |
Http.MultipartFormData body = request().body().asMultipartFormData(); |
254 | 254 |
if (body == null) { |
255 | 255 |
return new String[] {}; |
--- app/controllers/MilestoneApp.java
+++ app/controllers/MilestoneApp.java
... | ... | @@ -23,6 +23,7 @@ |
23 | 23 |
import controllers.annotation.AnonymousCheck; |
24 | 24 |
import controllers.annotation.IsAllowed; |
25 | 25 |
import controllers.annotation.IsCreatable; |
26 |
+import models.AbstractPosting; |
|
26 | 27 |
import models.Attachment; |
27 | 28 |
import models.Milestone; |
28 | 29 |
import models.Project; |
... | ... | @@ -103,15 +104,10 @@ |
103 | 104 |
} else { |
104 | 105 |
Milestone newMilestone = milestoneForm.get(); |
105 | 106 |
|
106 |
- if (newMilestone.contents == null) { |
|
107 |
- return status(REQUEST_ENTITY_TOO_LARGE, |
|
108 |
- ErrorViews.RequestTextEntityTooLarge.render()); |
|
109 |
- } |
|
110 |
- |
|
111 | 107 |
newMilestone.project = project; |
112 | 108 |
newMilestone.dueDate = JodaDateUtil.lastSecondOfDay(newMilestone.dueDate); |
113 | 109 |
Milestone.create(newMilestone); |
114 |
- Attachment.moveAll(UserApp.currentUser().asResource(), newMilestone.asResource()); |
|
110 |
+ AbstractPostingApp.attachUploadFilesToPost(newMilestone.asResource()); |
|
115 | 111 |
return redirect(routes.MilestoneApp.milestone(userName, projectName, newMilestone.id)); |
116 | 112 |
} |
117 | 113 |
} |
--- app/models/Milestone.java
+++ app/models/Milestone.java
... | ... | @@ -60,7 +60,7 @@ |
60 | 60 |
@Formats.DateTime(pattern = "yyyy-MM-dd") |
61 | 61 |
public Date dueDate; |
62 | 62 |
|
63 |
- @Constraints.Required @Lob |
|
63 |
+ @Lob |
|
64 | 64 |
public String contents; |
65 | 65 |
|
66 | 66 |
@Constraints.Required |
--- app/views/milestone/view.scala.html
+++ app/views/milestone/view.scala.html
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 |
**@ |
21 | 21 |
@(title: String, milestone: models.Milestone, project: Project, issueState:State) |
22 | 22 |
@import scala.collection.immutable._ |
23 |
+@import org.apache.commons.lang.StringUtils |
|
23 | 24 |
@import utils.TemplateHelper._ |
24 | 25 |
@import utils.AccessControl._ |
25 | 26 |
@import models.support.SearchCondition |
... | ... | @@ -59,10 +60,15 @@ |
59 | 60 |
<div class="progress progress-success"> |
60 | 61 |
<div class="bar" style="width: @milestone.getCompletionRate%;"></div> |
61 | 62 |
</div> |
62 |
- <div class="milestone-desc"> |
|
63 |
- <div class="markdown-wrap">@Html(Markdown.render(milestone.contents, milestone.project))</div> |
|
64 |
- <div class="attachments" data-attachments="@toJson(AttachmentApp.getFileList(ResourceType.MILESTONE.toString(), milestone.id.toString()))"></div> |
|
65 |
- </div> |
|
63 |
+ @if(StringUtils.isEmpty(milestone.contents)){ |
|
64 |
+ <div class="content empty-content"></div> |
|
65 |
+ } else { |
|
66 |
+ <div class="milestone-desc"> |
|
67 |
+ <div class="markdown-wrap">@Html(Markdown.render(milestone.contents, milestone.project))</div> |
|
68 |
+ <div class="attachments" data-attachments="@toJson(AttachmentApp.getFileList(ResourceType.MILESTONE.toString(), milestone.id.toString()))"></div> |
|
69 |
+ </div> |
|
70 |
+ } |
|
71 |
+ |
|
66 | 72 |
|
67 | 73 |
<div class="actrow right-txt row-fluid" style="padding: 15px 0; clear:both;"> |
68 | 74 |
<a href="@routes.MilestoneApp.milestones(project.owner, project.name)" class="ybtn pull-left">@Messages("button.list")</a> |
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?