Merge branch 'origin/main' into 'next-release/main'

This commit is contained in:
oauth 2024-11-09 06:27:53 +00:00
commit 4a7dadebc7
2 changed files with 18 additions and 8 deletions

View file

@ -362,7 +362,6 @@ func GetRepoPermissions(c *gin.Context) {
func GetRepoBranches(c *gin.Context) { func GetRepoBranches(c *gin.Context) {
_store := store.FromContext(c) _store := store.FromContext(c)
repo := session.Repo(c) repo := session.Repo(c)
user := session.User(c)
_forge, err := server.Config.Services.Manager.ForgeFromRepo(repo) _forge, err := server.Config.Services.Manager.ForgeFromRepo(repo)
if err != nil { if err != nil {
log.Error().Err(err).Msg("Cannot get forge from repo") log.Error().Err(err).Msg("Cannot get forge from repo")
@ -370,9 +369,15 @@ func GetRepoBranches(c *gin.Context) {
return return
} }
forge.Refresh(c, _forge, _store, user) repoUser, err := _store.GetUser(repo.UserID)
if err != nil {
handleDBError(c, err)
return
}
branches, err := _forge.Branches(c, user, repo, session.Pagination(c)) forge.Refresh(c, _forge, _store, repoUser)
branches, err := _forge.Branches(c, repoUser, repo, session.Pagination(c))
if err != nil { if err != nil {
log.Error().Err(err).Msg("failed to load branches") log.Error().Err(err).Msg("failed to load branches")
c.String(http.StatusInternalServerError, "failed to load branches: %s", err) c.String(http.StatusInternalServerError, "failed to load branches: %s", err)
@ -396,7 +401,6 @@ func GetRepoBranches(c *gin.Context) {
func GetRepoPullRequests(c *gin.Context) { func GetRepoPullRequests(c *gin.Context) {
_store := store.FromContext(c) _store := store.FromContext(c)
repo := session.Repo(c) repo := session.Repo(c)
user := session.User(c)
_forge, err := server.Config.Services.Manager.ForgeFromRepo(repo) _forge, err := server.Config.Services.Manager.ForgeFromRepo(repo)
if err != nil { if err != nil {
log.Error().Err(err).Msg("Cannot get forge from repo") log.Error().Err(err).Msg("Cannot get forge from repo")
@ -404,9 +408,15 @@ func GetRepoPullRequests(c *gin.Context) {
return return
} }
forge.Refresh(c, _forge, _store, user) repoUser, err := _store.GetUser(repo.UserID)
if err != nil {
handleDBError(c, err)
return
}
prs, err := _forge.PullRequests(c, user, repo, session.Pagination(c)) forge.Refresh(c, _forge, _store, repoUser)
prs, err := _forge.PullRequests(c, repoUser, repo, session.Pagination(c))
if err != nil { if err != nil {
_ = c.AbortWithError(http.StatusInternalServerError, err) _ = c.AbortWithError(http.StatusInternalServerError, err)
return return

View file

@ -42,8 +42,8 @@ type Pipeline struct {
Message string `json:"message" xorm:"TEXT 'message'"` Message string `json:"message" xorm:"TEXT 'message'"`
Timestamp int64 `json:"timestamp" xorm:"'timestamp'"` Timestamp int64 `json:"timestamp" xorm:"'timestamp'"`
Sender string `json:"sender" xorm:"sender"` // uses reported user for webhooks and name of cron for cron pipelines Sender string `json:"sender" xorm:"sender"` // uses reported user for webhooks and name of cron for cron pipelines
Avatar string `json:"author_avatar" xorm:"avatar"` Avatar string `json:"author_avatar" xorm:"varchar(500) avatar"`
Email string `json:"author_email" xorm:"email"` Email string `json:"author_email" xorm:"varchar(500) email"`
ForgeURL string `json:"forge_url" xorm:"forge_url"` ForgeURL string `json:"forge_url" xorm:"forge_url"`
Reviewer string `json:"reviewed_by" xorm:"reviewer"` Reviewer string `json:"reviewed_by" xorm:"reviewer"`
Reviewed int64 `json:"reviewed" xorm:"reviewed"` Reviewed int64 `json:"reviewed" xorm:"reviewed"`