mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-19 04:37:16 +02:00
@ -24,8 +24,8 @@ func init() {
|
||||
}
|
||||
|
||||
// StarRepo or unstar repository.
|
||||
func StarRepo(userID, repoID int64, star bool) error {
|
||||
ctx, committer, err := db.TxContext(db.DefaultContext)
|
||||
func StarRepo(ctx context.Context, userID, repoID int64, star bool) error {
|
||||
ctx, committer, err := db.TxContext(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -72,8 +72,8 @@ func IsStaring(ctx context.Context, userID, repoID int64) bool {
|
||||
}
|
||||
|
||||
// GetStargazers returns the users that starred the repo.
|
||||
func GetStargazers(repo *Repository, opts db.ListOptions) ([]*user_model.User, error) {
|
||||
sess := db.GetEngine(db.DefaultContext).Where("star.repo_id = ?", repo.ID).
|
||||
func GetStargazers(ctx context.Context, repo *Repository, opts db.ListOptions) ([]*user_model.User, error) {
|
||||
sess := db.GetEngine(ctx).Where("star.repo_id = ?", repo.ID).
|
||||
Join("LEFT", "star", "`user`.id = star.uid")
|
||||
if opts.Page > 0 {
|
||||
sess = db.SetSessionPagination(sess, &opts)
|
||||
|
Reference in New Issue
Block a user