Browse Source

提交代码

tags/v1.22.3.2^2
ychao_1983 3 years ago
parent
commit
915b3a6d94
2 changed files with 8 additions and 3 deletions
  1. +6
    -3
      models/dataset_star.go
  2. +2
    -0
      modules/context/repo.go

+ 6
- 3
models/dataset_star.go View File

@@ -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 {


+ 2
- 0
modules/context/repo.go View File

@@ -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 {


Loading…
Cancel
Save