diff --git a/models/dataset_star.go b/models/dataset_star.go index fac08caee..5dedb2ba4 100644 --- a/models/dataset_star.go +++ b/models/dataset_star.go @@ -51,9 +51,12 @@ func StarDataset(userID, datasetID int64, star bool) error { return sess.Commit() } -func IsDatasetStaring(userID, datasetID int64) bool { - - return isDatasetStaring(x, userID, datasetID) +func IsDatasetStaringByRepoId(userID, repoID int64) bool { + dataset, _ := GetDatasetByRepo(&Repository{ID: repoID}) + if dataset == nil { + return false + } + return isDatasetStaring(x, userID, dataset.ID) } func isDatasetStaring(e Engine, userID, datasetID int64) bool { diff --git a/modules/context/repo.go b/modules/context/repo.go index 64f02c921..7c425c8c0 100755 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -475,6 +475,8 @@ func RepoAssignment() macaron.Handler { if ctx.IsSigned { ctx.Data["IsWatchingRepo"] = models.IsWatching(ctx.User.ID, repo.ID) ctx.Data["IsStaringRepo"] = models.IsStaring(ctx.User.ID, repo.ID) + + ctx.Data["IsStaringDataset"] = models.IsDatasetStaringByRepoId(ctx.User.ID, repo.ID) } if repo.IsFork {