|
|
|
@ -9,6 +9,7 @@ import (
|
|
|
|
|
"context"
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
"html/template"
|
|
|
|
|
"io"
|
|
|
|
|
"net/http"
|
|
|
|
|
"net/url"
|
|
|
|
@ -29,6 +30,7 @@ import (
|
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
|
|
|
|
"code.gitea.io/gitea/modules/storage"
|
|
|
|
|
api "code.gitea.io/gitea/modules/structs"
|
|
|
|
|
"code.gitea.io/gitea/modules/templates"
|
|
|
|
|
"code.gitea.io/gitea/modules/timeutil"
|
|
|
|
|
"code.gitea.io/gitea/modules/util"
|
|
|
|
|
"code.gitea.io/gitea/modules/web"
|
|
|
|
@ -89,6 +91,7 @@ type ViewResponse struct {
|
|
|
|
|
Run struct {
|
|
|
|
|
Link string `json:"link"`
|
|
|
|
|
Title string `json:"title"`
|
|
|
|
|
TitleHTML template.HTML `json:"titleHTML"`
|
|
|
|
|
Status string `json:"status"`
|
|
|
|
|
CanCancel bool `json:"canCancel"`
|
|
|
|
|
CanApprove bool `json:"canApprove"` // the run needs an approval and the doer has permission to approve
|
|
|
|
@ -200,7 +203,10 @@ func ViewPost(ctx *context_module.Context) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
metas := ctx.Repo.Repository.ComposeMetas(ctx)
|
|
|
|
|
|
|
|
|
|
resp.State.Run.Title = run.Title
|
|
|
|
|
resp.State.Run.TitleHTML = templates.NewRenderUtils(ctx).RenderCommitMessage(run.Title, metas)
|
|
|
|
|
resp.State.Run.Link = run.Link()
|
|
|
|
|
resp.State.Run.CanCancel = !run.Status.IsDone() && ctx.Repo.CanWrite(unit.TypeActions)
|
|
|
|
|
resp.State.Run.CanApprove = run.NeedApproval && ctx.Repo.CanWrite(unit.TypeActions)
|
|
|
|
|