| @@ -384,6 +384,7 @@ func getPrivateAttachments(e Engine, userID int64) ([]*AttachmentUsername, error | |||||
| return attachments, nil | return attachments, nil | ||||
| } | } | ||||
| /* | |||||
| func GetAllUserAttachments(userID int64) ([]*AttachmentUsername, error) { | func GetAllUserAttachments(userID int64) ([]*AttachmentUsername, error) { | ||||
| attachsPub, err := getAllPublicAttachments(x) | attachsPub, err := getAllPublicAttachments(x) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -400,3 +401,17 @@ func GetAllUserAttachments(userID int64) ([]*AttachmentUsername, error) { | |||||
| return append(attachsPub, attachsPri...), nil | return append(attachsPub, attachsPri...), nil | ||||
| } | } | ||||
| */ | |||||
| func getAllUserAttachments(e Engine, userID int64) ([]*AttachmentUsername, error) { | |||||
| attachments := make([]*AttachmentUsername, 0, 10) | |||||
| if err := e.Table("attachment").Join("LEFT", "`user`", "attachment.uploader_id " + | |||||
| "= `user`.id").Where("decompress_state= ? and (uploader_id= ? or is_private = ?)", DecompressStateDone, userID, false).Find(&attachments); err != nil { | |||||
| return nil, err | |||||
| } | |||||
| return attachments, nil | |||||
| } | |||||
| func GetAllUserAttachments(userID int64) ([]*AttachmentUsername, error) { | |||||
| return getAllUserAttachments(x, userID) | |||||
| } | |||||