forked from forgejo/forgejo
WIP: create PR - choose branch
This commit is contained in:
parent
d015d951bd
commit
dea3a8c6a4
34 changed files with 396 additions and 212 deletions
|
@ -104,7 +104,7 @@ func Dashboard(ctx *middleware.Context) {
|
|||
for _, act := range actions {
|
||||
if act.IsPrivate {
|
||||
// This prevents having to retrieve the repository for each action
|
||||
repo := &models.Repository{Id: act.RepoID, IsPrivate: true}
|
||||
repo := &models.Repository{ID: act.RepoID, IsPrivate: true}
|
||||
if act.RepoUserName != ctx.User.LowerName {
|
||||
if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
|
||||
continue
|
||||
|
@ -212,7 +212,7 @@ func Profile(ctx *middleware.Context) {
|
|||
continue
|
||||
}
|
||||
// This prevents having to retrieve the repository for each action
|
||||
repo := &models.Repository{Id: act.RepoID, IsPrivate: true}
|
||||
repo := &models.Repository{ID: act.RepoID, IsPrivate: true}
|
||||
if act.RepoUserName != ctx.User.LowerName {
|
||||
if has, _ := models.HasAccess(ctx.User, repo, models.ACCESS_MODE_READ); !has {
|
||||
continue
|
||||
|
@ -295,21 +295,21 @@ func Issues(ctx *middleware.Context) {
|
|||
continue
|
||||
}
|
||||
|
||||
repoIds = append(repoIds, repo.Id)
|
||||
repoIds = append(repoIds, repo.ID)
|
||||
repo.NumOpenIssues = repo.NumIssues - repo.NumClosedIssues
|
||||
issueStats.AllCount += int64(repo.NumOpenIssues)
|
||||
|
||||
if isShowClosed {
|
||||
if repo.NumClosedIssues > 0 {
|
||||
if filterMode == models.FM_CREATE {
|
||||
repo.NumClosedIssues = int(models.GetIssueCountByPoster(ctx.User.Id, repo.Id, isShowClosed))
|
||||
repo.NumClosedIssues = int(models.GetIssueCountByPoster(ctx.User.Id, repo.ID, isShowClosed))
|
||||
}
|
||||
showRepos = append(showRepos, repo)
|
||||
}
|
||||
} else {
|
||||
if repo.NumOpenIssues > 0 {
|
||||
if filterMode == models.FM_CREATE {
|
||||
repo.NumOpenIssues = int(models.GetIssueCountByPoster(ctx.User.Id, repo.Id, isShowClosed))
|
||||
repo.NumOpenIssues = int(models.GetIssueCountByPoster(ctx.User.Id, repo.ID, isShowClosed))
|
||||
}
|
||||
showRepos = append(showRepos, repo)
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ func Issues(ctx *middleware.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
issues[i].Repo, err = models.GetRepositoryById(issues[i].RepoID)
|
||||
issues[i].Repo, err = models.GetRepositoryByID(issues[i].RepoID)
|
||||
if err != nil {
|
||||
if models.IsErrRepoNotExist(err) {
|
||||
log.Warn("GetRepositoryById[%d]: repository not exist", issues[i].RepoID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue