fixed PR issue
This commit is contained in:
@@ -30,19 +30,7 @@ type accessTokenResponse struct {
|
||||
}
|
||||
|
||||
func (h *AccessTokenHandler) lookupRepo(w http.ResponseWriter, r *http.Request) (*models.Repository, bool) {
|
||||
ownerName := chi.URLParam(r, "owner")
|
||||
repoName := chi.URLParam(r, "repo")
|
||||
var owner models.User
|
||||
if found, _ := h.db.Where("username = ?", ownerName).Get(&owner); !found {
|
||||
jsonError(w, "repository not found", http.StatusNotFound)
|
||||
return nil, false
|
||||
}
|
||||
var repo models.Repository
|
||||
if found, _ := h.db.Where("owner_id = ? AND name = ?", owner.ID, repoName).Get(&repo); !found {
|
||||
jsonError(w, "repository not found", http.StatusNotFound)
|
||||
return nil, false
|
||||
}
|
||||
return &repo, true
|
||||
return resolveRepo(h.db, w, r)
|
||||
}
|
||||
|
||||
func (h *AccessTokenHandler) canManage(repo *models.Repository, callerID int64) bool {
|
||||
|
||||
Reference in New Issue
Block a user