Skip to content

Commit 3f5c90a

Browse files
committed
marking the part involved
1 parent ca6fb00 commit 3f5c90a

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

models/issue.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,7 @@ func newIssue(e *xorm.Session, doer *User, opts NewIssueOptions) (err error) {
11641164
return err
11651165
}
11661166

1167+
/* TODO set this at upload
11671168
if len(opts.Attachments) > 0 {
11681169
attachments, err := getAttachmentsByUUIDs(e, opts.Attachments)
11691170
if err != nil {
@@ -1177,6 +1178,7 @@ func newIssue(e *xorm.Session, doer *User, opts NewIssueOptions) (err error) {
11771178
}
11781179
}
11791180
}
1181+
*/
11801182

11811183
return opts.Issue.loadAttributes(e)
11821184
}

models/issue_comment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ func sendCreateCommentAction(e *xorm.Session, opts *CreateCommentOptions, commen
604604
if _, err = e.Exec("UPDATE `issue` SET num_comments=num_comments+1 WHERE id=?", opts.Issue.ID); err != nil {
605605
return err
606606
}
607-
607+
/* TODO set it at upload
608608
// Check attachments
609609
attachments := make([]*Attachment, 0, len(opts.Attachments))
610610
for _, uuid := range opts.Attachments {
@@ -626,7 +626,7 @@ func sendCreateCommentAction(e *xorm.Session, opts *CreateCommentOptions, commen
626626
return fmt.Errorf("update attachment [%d]: %v", attachments[i].ID, err)
627627
}
628628
}
629-
629+
*/
630630
case CommentTypeReopen:
631631
act.OpType = ActionReopenIssue
632632
if opts.Issue.IsPull {

models/release.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func createTag(gitRepo *git.Repository, rel *Release) error {
147147
}
148148
return nil
149149
}
150-
150+
/* TODO set this at upload
151151
func addReleaseAttachments(releaseID int64, attachmentUUIDs []string) (err error) {
152152
// Check attachments
153153
var attachments = make([]*Attachment, 0)
@@ -172,6 +172,7 @@ func addReleaseAttachments(releaseID int64, attachmentUUIDs []string) (err error
172172
173173
return
174174
}
175+
*/
175176

176177
// CreateRelease creates a new release of repository.
177178
func CreateRelease(gitRepo *git.Repository, rel *Release, attachmentUUIDs []string) error {

public/js/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,16 +343,16 @@ function retrieveImageFromClipboardAsBlob(pasteEvent, callback){
343343
}
344344
}
345345

346-
function uploadFile(file, callback) {
346+
function uploadFile(contextPath, file, callback) {
347347
const xhr = new XMLHttpRequest();
348348

349349
xhr.onload = function() {
350350
if (xhr.status == 200) {
351351
callback(xhr.responseText);
352352
}
353353
};
354-
355-
xhr.open("post", suburl + "/attachments", true);
354+
//TODO contextPath
355+
xhr.open("post", suburl + "/" + contextPath + "/attachments", true);
356356
xhr.setRequestHeader("X-Csrf-Token", csrf);
357357
const formData = new FormData();
358358
formData.append('file', file, file.name);

routers/routes/routes.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,6 @@ func RegisterRoutes(m *macaron.Macaron) {
508508
})
509509
}, ignSignIn)
510510

511-
m.Group("", func() {
512-
m.Post("/attachments", repo.UploadAttachment)
513-
}, reqSignIn)
514-
515511
m.Group("/:username", func() {
516512
m.Get("/action/:action", user.Action)
517513
}, reqSignIn)
@@ -774,6 +770,7 @@ func RegisterRoutes(m *macaron.Macaron) {
774770
m.Get("/new", repo.NewRelease)
775771
m.Post("/new", bindIgnErr(auth.NewReleaseForm{}), repo.NewReleasePost)
776772
m.Post("/delete", repo.DeleteRelease)
773+
m.Post("/attachments", repo.UploadAttachment)
777774
}, reqSignIn, repo.MustBeNotEmpty, context.RepoMustNotBeArchived(), reqRepoReleaseWriter, context.RepoRef())
778775
m.Group("/releases", func() {
779776
m.Get("/edit/*", repo.EditRelease)

0 commit comments

Comments
 (0)