| @@ -522,7 +522,6 @@ func MyFavoriteDataset(ctx *context.Context) { | |||||
| } | } | ||||
| datasets := IsColDatasets | datasets := IsColDatasets | ||||
| count := NotColcount + IsColcount | count := NotColcount + IsColcount | ||||
| //排序 | |||||
| sort.Slice(datasets, func(i, j int) bool { | sort.Slice(datasets, func(i, j int) bool { | ||||
| return datasets[i].Attachment.CreatedUnix > datasets[j].Attachment.CreatedUnix | return datasets[i].Attachment.CreatedUnix > datasets[j].Attachment.CreatedUnix | ||||
| }) | }) | ||||
| @@ -613,23 +612,28 @@ func GetDatasetStatus(ctx *context.Context) { | |||||
| func DatasetIsCollaborator(ctx *context.Context, DatasetID int64) bool { | func DatasetIsCollaborator(ctx *context.Context, DatasetID int64) bool { | ||||
| dataset, err := models.GetDatasetByID(DatasetID) | dataset, err := models.GetDatasetByID(DatasetID) | ||||
| if err != nil { | if err != nil { | ||||
| log.Info("query dataset error") | |||||
| log.Error("query dataset error:", err.Error()) | |||||
| return false | |||||
| } else { | } else { | ||||
| repo, err := models.GetRepositoryByID(dataset.RepoID) | repo, err := models.GetRepositoryByID(dataset.RepoID) | ||||
| if err != nil { | if err != nil { | ||||
| log.Info("query repo error.") | |||||
| log.Error("query repo error:", err.Error()) | |||||
| } else { | } else { | ||||
| repo.GetOwner() | repo.GetOwner() | ||||
| if ctx.User != nil { | if ctx.User != nil { | ||||
| if repo.Owner.IsOrganization() { | if repo.Owner.IsOrganization() { | ||||
| if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { | if repo.Owner.IsUserPartOfOrg(ctx.User.ID) { | ||||
| log.Info("org user may visit the attach.") | |||||
| return true | |||||
| for _, t := range repo.Owner.Teams { | |||||
| if t.IsMember(ctx.User.ID) && t.HasRepository(repo.ID) { | |||||
| return true | |||||
| } | |||||
| } | |||||
| return false | |||||
| } | } | ||||
| } | } | ||||
| isCollaborator, _ := repo.IsCollaborator(ctx.User.ID) | isCollaborator, _ := repo.IsCollaborator(ctx.User.ID) | ||||
| if isCollaborator { | if isCollaborator { | ||||
| log.Info("Collaborator user may visit the attach.") | |||||
| return true | return true | ||||
| } | } | ||||
| } | } | ||||