summaryrefslogtreecommitdiffstats
path: root/modules/middleware/context.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-03-06 23:57:46 -0500
committerUnknwon <u@gogs.io>2016-03-06 23:57:46 -0500
commit0e9bc2d4108ae32611e4fe65af493913c20d0279 (patch)
tree58addb3ebbc98174543f5fc44bd60599941e3dd1 /modules/middleware/context.go
parent0ea0c5ec4f24f0fc5ef3231085c74b33a16f98ec (diff)
downloadgitea-0e9bc2d4108ae32611e4fe65af493913c20d0279.tar.gz
gitea-0e9bc2d4108ae32611e4fe65af493913c20d0279.zip
Fix pull request availability check
Diffstat (limited to 'modules/middleware/context.go')
-rw-r--r--modules/middleware/context.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go
index cee5d10032..d2b7de4a27 100644
--- a/modules/middleware/context.go
+++ b/modules/middleware/context.go
@@ -27,6 +27,13 @@ import (
"github.com/gogits/gogs/modules/setting"
)
+type PullRequestContext struct {
+ BaseRepo *models.Repository
+ Allowed bool
+ SameRepo bool
+ HeadInfo string // [<user>:]<branch>
+}
+
type RepoContext struct {
AccessMode models.AccessMode
IsWatching bool
@@ -46,6 +53,8 @@ type RepoContext struct {
CloneLink models.CloneLink
CommitsCount int64
Mirror *models.Mirror
+
+ PullRequest *PullRequestContext
}
// Context represents context of a request.
@@ -211,7 +220,9 @@ func Contexter() macaron.Handler {
csrf: x,
Flash: f,
Session: sess,
- Repo: &RepoContext{},
+ Repo: &RepoContext{
+ PullRequest: &PullRequestContext{},
+ },
}
// Compute current URL for real-time change language.
ctx.Data["Link"] = setting.AppSubUrl + strings.TrimSuffix(ctx.Req.URL.Path, "/")