aboutsummaryrefslogtreecommitdiffstats
path: root/models/star.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/star.go')
-rw-r--r--models/star.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/models/star.go b/models/star.go
index 96f876ba0a..18d28b558a 100644
--- a/models/star.go
+++ b/models/star.go
@@ -21,7 +21,7 @@ func StarRepo(userID, repoID int64, star bool) error {
}
if star {
- if IsStaring(userID, repoID) {
+ if isStaring(sess, userID, repoID) {
return nil
}
@@ -35,7 +35,7 @@ func StarRepo(userID, repoID int64, star bool) error {
return err
}
} else {
- if !IsStaring(userID, repoID) {
+ if !isStaring(sess, userID, repoID) {
return nil
}
@@ -55,7 +55,11 @@ func StarRepo(userID, repoID int64, star bool) error {
// IsStaring checks if user has starred given repository.
func IsStaring(userID, repoID int64) bool {
- has, _ := x.Get(&Star{0, userID, repoID})
+ return isStaring(x, userID, repoID)
+}
+
+func isStaring(e Engine, userID, repoID int64) bool {
+ has, _ := e.Get(&Star{0, userID, repoID})
return has
}