| @@ -813,10 +813,10 @@ func CloudBrainShowModels(ctx *context.Context) { | |||||
| } | } | ||||
| func GetPublicImages(ctx *context.Context) { | func GetPublicImages(ctx *context.Context) { | ||||
| uid := getUID(ctx) | |||||
| opts := models.SearchImageOptions{ | opts := models.SearchImageOptions{ | ||||
| IncludePublicOnly: true, | IncludePublicOnly: true, | ||||
| UID: -1, | |||||
| UID: uid, | |||||
| Keyword: ctx.Query("q"), | Keyword: ctx.Query("q"), | ||||
| Topics: ctx.Query("topic"), | Topics: ctx.Query("topic"), | ||||
| IncludeOfficialOnly: ctx.QueryBool("recommend"), | IncludeOfficialOnly: ctx.QueryBool("recommend"), | ||||
| @@ -828,10 +828,7 @@ func GetPublicImages(ctx *context.Context) { | |||||
| } | } | ||||
| func GetCustomImages(ctx *context.Context) { | func GetCustomImages(ctx *context.Context) { | ||||
| var uid int64 = -1 | |||||
| if ctx.IsSigned { | |||||
| uid = ctx.User.ID | |||||
| } | |||||
| uid := getUID(ctx) | |||||
| opts := models.SearchImageOptions{ | opts := models.SearchImageOptions{ | ||||
| UID: uid, | UID: uid, | ||||
| IncludeOwnerOnly: true, | IncludeOwnerOnly: true, | ||||
| @@ -844,10 +841,7 @@ func GetCustomImages(ctx *context.Context) { | |||||
| } | } | ||||
| func GetStarImages(ctx *context.Context) { | func GetStarImages(ctx *context.Context) { | ||||
| var uid int64 = -1 | |||||
| if ctx.IsSigned { | |||||
| uid = ctx.User.ID | |||||
| } | |||||
| uid := getUID(ctx) | |||||
| opts := models.SearchImageOptions{ | opts := models.SearchImageOptions{ | ||||
| UID: uid, | UID: uid, | ||||
| IncludeStarByMe: true, | IncludeStarByMe: true, | ||||
| @@ -859,10 +853,18 @@ func GetStarImages(ctx *context.Context) { | |||||
| } | } | ||||
| func GetAllImages(ctx *context.Context) { | |||||
| func getUID(ctx *context.Context) int64 { | |||||
| var uid int64 = -1 | |||||
| if ctx.IsSigned { | |||||
| uid = ctx.User.ID | |||||
| } | |||||
| return uid | |||||
| } | |||||
| func GetAllImages(ctx *context.Context) { | |||||
| uid := getUID(ctx) | |||||
| opts := models.SearchImageOptions{ | opts := models.SearchImageOptions{ | ||||
| UID: -1, | |||||
| UID: uid, | |||||
| Keyword: ctx.Query("q"), | Keyword: ctx.Query("q"), | ||||
| Topics: ctx.Query("topic"), | Topics: ctx.Query("topic"), | ||||
| SearchOrderBy: "id desc", | SearchOrderBy: "id desc", | ||||