|
|
|
@@ -59,6 +59,7 @@ func UploadAttachment(ctx *context.Context) { |
|
|
|
datasetID, _ := strconv.ParseInt(ctx.Req.FormValue("dataset_id"), 10, 64) |
|
|
|
|
|
|
|
attach, err := models.NewAttachment(&models.Attachment{ |
|
|
|
IsPrivate: false, |
|
|
|
UploaderID: ctx.User.ID, |
|
|
|
Name: header.Filename, |
|
|
|
DatasetID: datasetID, |
|
|
|
@@ -74,6 +75,18 @@ func UploadAttachment(ctx *context.Context) { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
func UpdatePublicAttachment(ctx *context.Context) { |
|
|
|
file := ctx.Query("file") |
|
|
|
isPrivate, _ := strconv.ParseBool(ctx.Query("is_private")) |
|
|
|
attach, err := models.GetAttachmentByUUID(file) |
|
|
|
if err != nil { |
|
|
|
ctx.Error(404, err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
attach.IsPrivate = isPrivate |
|
|
|
models.UpdateAttachment(attach) |
|
|
|
} |
|
|
|
|
|
|
|
// DeleteAttachment response for deleting issue's attachment |
|
|
|
func DeleteAttachment(ctx *context.Context) { |
|
|
|
file := ctx.Query("file") |
|
|
|
|