Browse Source

#999

fix bug
tags/v1.21.12.1^2
chenyifan01 4 years ago
parent
commit
1bf092295f
2 changed files with 9 additions and 0 deletions
  1. +4
    -0
      models/dataset.go
  2. +5
    -0
      routers/user/profile.go

+ 4
- 0
models/dataset.go View File

@@ -93,6 +93,7 @@ type SearchDatasetOptions struct {
IncludePublic bool
ListOptions
SearchOrderBy
IsOwner bool
}

func CreateDataset(dataset *Dataset) (err error) {
@@ -150,6 +151,9 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond {
}
} else if opts.OwnerID > 0 {
cond = cond.And(builder.Eq{"repository.owner_id": opts.OwnerID})
if !opts.IsOwner {
cond = cond.And(builder.Eq{"dataset.status": DatasetStatusPublic})
}
}

return cond


+ 5
- 0
routers/user/profile.go View File

@@ -210,10 +210,15 @@ func Profile(ctx *context.Context) {

total = int(count)
case "datasets":
var isOwner = false
if ctx.User != nil && ctx.User.ID == ctxUser.ID {
isOwner = true
}
datasetSearchOptions := &models.SearchDatasetOptions{
Keyword: keyword,
OwnerID: ctxUser.ID,
SearchOrderBy: orderBy,
IsOwner: isOwner,
ListOptions: models.ListOptions{
Page: page,
PageSize: setting.UI.ExplorePagingNum,


Loading…
Cancel
Save